Software Design Patterns – An insight

Design Patterns are reusable solutions to the problems software architecture faces regularly.  Patterns must explain why the solution provided is the best amongst the equals.

Most popular 23 Gang of Four patterns are considered to be the base of all patterns.  These patterns are categorised in three groups:

1. Creational Patterns: These patterns help create object for you, hence giving flexibility in making decision for a given case.

a. Factory method: Creates an instance without specifying the exact class. It lets defer instantiation to subclasses.factory

 

b. Abstract Factory: It helps create several families of classes. Provide an interface for creating families of related classes without specifying there exact class.abstract

c. Builder : It help separate complex construction from representation and hence allowing same construction process to create multiple representation. builder

d. Prototype:  It helps create objects by cloning existing objects. prototype

e. Singleton : Restricts object creation to only one single object.singleton

f. Object Pool: Avoid expensive creation and deletion of resources by recycling objects that are no longer in use. Object_pool

g. : Multiton : Its an extension of singleton class objects by keeping key value pairs.cls-utl-multiton

2. Structural Patterns: These patterns help structure object composition using inheritance.  By achieving different object composition they attain new functionality.

a. Adapter: Matches interfaces of incompatible classes by wrapping up its own interface around. adapter

b. Bridge: It allows decoupling of interface with its implementation, so that two can vary independently. bridge

c. Composite: Composes one or more similar objects to represent part-whole hierarchies. It lets client treat individual objects of the whole composition uniformly. composite

d. Decorator: It dynamically adds features on an existing object. It provides a flexible alternative to sub-classing for extending functionality.

decorator

e. Facade: Provides a simple interface for a large subsystem. facade

f. Flyweight: It reduces the cost of creating and manipulating a large number of similar objects. flyweight

g. Proxy: Provides a surrogate for another object to control access, reduce cost, and reduce complexity.proxy

 

h. Front Controller : It provides centralized entry point for handling requests. Its mostly for Web Applications. FCMainClass

i. Module : Group of related classes, methods into single conceptual entity. Module-software-design-pattern

3. Behavioral Patterns: These patterns resolve communication issues with objects.

a. Chain of Responsibility: Delegates the command to chain of processing objects and hence avoid coupling the sender of request to receiver. chain

b. Command: Creates request that encapsulate actions and parameters hence let us do undo-able operations.command

c. Interpreter: It lets us define grammar of specialised language. interpreter

d. Iterator: Sequentially access elements of an object without exposing its internal representation. iterator
e. Mediator: Promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. mediator

f. Memento : Allows undo operation by capturing and restoring its original state. memento

g. Observer: Publish/Subscribe pattern that allows various objects to see an event. observer

h. State : It allows changing of behaviour of an object when its internal state changes. state

i. Strategy: It allows one of the family of algorithm to be selected in the runtime. strategy

j. Template: Defines skeleton of the algorithm as base classes, letting subclass define its concrete behaviourtemplate

k. Visitor: It lets you define new operation without changing the classes of the elements. It separates an algorithm from its object structure by moving the hierarchy of methods into one object visitor

L. BlackBoard: Generalized observer, which allows various readers & writes, distributes information system wide. Blackboard

M. Null Object: Provides a surrogate for another object that shares the same interface but does nothing. nullobject

O. Servant : It separates out common functionality from a group of classes.  It implements some functionality which is common to group of classes and is not defined in them. servant

P. Specification Pattern: Outlines business rule that is combinable with other business rule. A unit of business logic inherits its functionality from abstract aggregate composite specification. Specification_UML_v2

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>