Design Patterns

Posted: November 30, 2010 in Design Patterns

I am great fan of Design pattern and have been trying hard to understand GOF patterns. Design patterns are the solutions to most common problems faced in the software industry. They are proven solutions to a problem and are again scenario dependent. They are just templates for most commonly occuring problems. As a software engineer, we should not try to code according to a specific pattern in our application just to learn it. We are expected to understand the intent behind a specific pattern and then try to fit that pattern into our application based on needs.

They are broadly classified into 3 types :

1. Creational patterns – deals with object instantiation
2. Structural patterns – deals more with object composition to address functionalities.
3. Behavior patterns – deals with communication between objects.

GOF patterns are as listed below :

Creational Patterns

1. Abstract Factory : Creates an instance of several families of classes
2. Builder : Separates object construction from its representation
3. Factory : Creates an instance of several derived classes
4. Prototype : A fully initialized instance to be copied or cloned
5. Singleton : A class of which only a single instance can exist

Structural Patterns

1. Adapter : Match interfaces of different classes
2. Bridge : Separates an object’s interface from its implementation
3. Composite : A tree structure of simple and composite objects
4. Decorator : Add responsibilities to objects dynamically
5. Facade : A single class that represents an entire subsystem
6. Flyweight : A fine-grained instance used for efficient sharing
7. Proxy : An object representing another object

Behavioral Patterns
1. Chain of Resp : A way of passing a request between a chain of objects
2. Command : Encapsulate a command request as an object
3. Interpreter : A way to include language elements in a program
4. Iterator : Sequentially access the elements of a collection
5. Mediator : Defines simplified communication between classes
6. Memento : Capture and restore an object’s internal state
7. Observer : A way of notifying change to a number of classes
8. State : Alter an object’s behavior when its state changes
9. Strategy : Encapsulates an algorithm inside a class
10. Template : Defer the exact steps of an algorithm to a subclass
11. Visitor : Defines a new operation to a class without change

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s