Design Pattern

Design Pattern, is a technique that is being used to address problems which occur frequently, instead of rediscovering solutions from scratch.  For example, if we want to design the wheels of a vehicle, instead of researching between shapes like squares, rectangles, triangles, hexagons, octogens etc., we have taken the round shape, which is truly invented by our unknown ancestors.  

In traditional engineering fields like mechanical engineering, they have predefined design procedures to solve all the design problems.  For example, when designing a car, engineers have to resolve the transmission problem.  When designing the gear box, already they have predefined set of design procedures to follow. But unlike traditional engineering, in software development there are no finite set of procedures to create component centric designs.

Father of Pattern language, Christopher Alexander, an architect, had studied various cultures and noticed that only a finite set of reusable solutions had been used in every problem of architecture.  Then he came up with patterns, which describe problems and give universal solutions.  In 1977, he wrote a book “A Pattern Language: Towns, Buildings, Constructions” in which he presented a language based on patterns.  This book had listed some 253 patterns intended to solve every problem in architecture from small scale to large one.

Likewise, in Software Development, a design pattern provides a general reusable solution for the common problems that occur.  These solutions were obtained using trial and error method by numerous software developers over years.  The idea is to speed up the development process by providing well-tested, proven development or design paradigms.

The concept was first introduced by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, referred to as the Gang of Four (GoF), in their book “Design Patterns: Elements of Reusable Object-Oriented Software” published in the year 1995.  They came up with a collection of 23 patterns, which are simple reusable solution for those problems in software development.

Design patterns are independent of programming languages which means a design pattern represents an idea not a particular implementation.  By using design patterns, you can make your code more flexible, reusable and also easily maintainable.

It is not mandatory to implement design pattens in our projects unless otherwise needed.  But you need to have a better understanding in order to pick and implement the correct pattern as needed.

Benefits of Design Patterns:

  1. Design Pattern explicitly captures knowledge of experts and make their expertise, available to all designer/developer(s).
  2. Design Pattern improves communication among designer/developer(s) as pattern names itself form a vocabulary.
  3. Design pattern helps documenting the architecture of a system and hence enhances understanding.
  4. Design pattern enable large-scale reuse of software architectures.
  5. Design pattern may promote loose coupling between objects as it embraces well-tested OOP-Design’s best practices.
  6. Design pattern helps the developer to write flexible, optimal, reliable and easily maintainable codes; and thus, rework could be avoided.

Criticisms:

  1. Over usage of design patterns may increase complexity of programs.
  2. Developers, who are very much inclined towards Design Patterns, try to use design patterns forcibly in their programs without necessity.
  3. Some developers argue that Design patterns have no proof that they work and patterns might be needed only when the programming language lacks to solve problems. 
Scroll to top