Design Pattern Part – 1

Design patterns are documented tried and tested solutions for recurring software problems in a given design context. So basically you have a problem to be solved and the proposed solution in the form of design pattern for the same problem. Design patterns existed in some or other form right from the inception stage of software development. Let’s say if you want to implement a sorting algorithm the first thing comes to mind is bubble sort. So the problem is sorting and solution is bubble sort. Same holds true for design patterns which are recurring solutions to common problems of design, they provide practical and concrete solutions to real world problems. Design Pattern are very context specific, and they are ”Best-fits” for the given set of concerns/trade-offs. For Domain experts and experienced professional they are perfect solution and are as easy to apply as “Old hat”. Design patterns is a literary form for documenting best practices and a shared vocabulary for problem-solving discussions.

Design Pattern are an very powerful and effective means of reusing, collaborating, and developing upon existing experience/expertise of the seasoned professional.

Christopher Alexander says, “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice”.

Design pattern is designed not to reinvent the wheel using object oriented design but to provide general solution to the common occurring software problems. In the lifecycle of software development it is normal for some requirements to change, and dependent interface also change. This leads to introduction of design pattern to Interface between old object and another object with modified interface.

Design patterns are helpful to object oriented programmer for e.g. Asp.NET pages contains lot of internal navigation logic and are connected to other pages. Routing logic between pages is one of the common logic is used by the application. This distribution of routing code between pages is actually an overhead to the application; it can fine tuned by abstracting and isolating the routing logic and substituting it with a design pattern in the application architecture so that it can be reused wherever required.

System requirements for the design pattern is very less as Design Pattern is a concept that is common to all languages and independent of all programming languages. There are 23 official standard Design patterns

There are three basic classifications of patterns Creational, Structural, and Behavioral patterns.

Creational Patterns

Abstract Factory:- Creates an instance of several families of classes
Builder: – Separates object construction from its representation
Factory Method:- Creates an instance of several derived classes
Prototype:- A fully initialized instance to be copied or cloned
Singleton:- A class in which only a single instance can exist

Structural Patterns

Adapter:-Match interfaces of different classes.
Bridge:-Separates an object’s abstraction from its implementation.
Composite:-A tree structure of simple and composite objects.
Decorator:-Add responsibilities to objects dynamically.
Façade:-A single class that represents an entire subsystem.
Flyweight:-A fine-grained instance used for efficient sharing.
Proxy:-An object representing another object.

Behavioral Patterns

Mediator:- Defines simplified communication between classes.
Memento:-Capture and restore an object’s internal state.
Interpreter:- A way to include language elements in a program.
Iterator:-Sequentially access the elements of a collection.
Chain of Responsibility: – A way of passing a request between a chain of objects.
Command:-Encapsulate a command request as an object.
State:-Alter an object’s behavior when its state changes.
Strategy:-Encapsulates an algorithm inside a class.
Observer: – A way of notifying change to a number of classes.
Template Method:- Defer the exact steps of an algorithm to a subclass.
Visitor:- Defines a new operation to a class without change.

Relationships between Design Patterns
Relationships between Design Patterns

This is the first of the series of blogs about design pattern I would be publishing. I would tried to explain them concisely and to the point to keep them very easy for reading and understand them. so that developers can use them effectively in developing of effective robust software.

Digg This

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s