Why Should We Learn Design Patterns?

Why Design Patterns?

From the perspective of a upcoming software engineer, this might feel a burden to understand & learn the different Design Patterns. Especially when there are so many technologies popping up into the market and every interview makes you feel like you are left behind in the race. For me at least this was the case where I was pondering on What’s the point of Design Patterns?, I should focus more of the different databases or a new programming language like Go instead of diving into Design Patterns.

Fortunately I did not skip this interesting concept of patterns and spent my weekends reading a few articles about the importance of Design Patterns and how they help manage the complexities of growing code. Not only it ease the code management but also helps avoiding potential bugs, and makes testing easy.

History

From Wikipedia: Patterns originated as an architectural concept by Christopher Alexander as early as 1977.

Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by the so called “Gang of Four” (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides), which is frequently abbreviated as “GoF”. That same year, the first Pattern Languages of Programming Conference was held, and the following year the Portland Pattern Repository was set up for documentation of design patterns.

Types of Design Patterns

Based on the usages, the design patterns are broadly grouped into three different categories.

  • Creational Design Patterns defines how we should create the objects based on different scenarios.
  • Behavioral Design Patterns defines the different communication patterns between objects adding more flexibility.
  • Structural Design Patterns defines patterns that help realizing the relationships between the objects and entities.

Note: Though these design patterns especially the ones coming from Gangs og Four are language independent but the catch is that they have been mostly seen having string affinity with static object oriented programming languages like C++ & Java.

Conclusion

Design patterns we see today has evolved from ages and are battle tested solutions for numerous problems that they solved. They are not the things to be used later but they are like the blueprints you should always consider before writing your own solutions.

In the next blog I will cover the Singleton Design Pattern. Stay tuned.