Object Oriented Design Patterns
Gang of Four: In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled: Design Patterns – Elements of Reusable Object Oriented Software.
What are Design Patterns?
They are a collection of easily identified and re-usable solutions to commonly occurring development problems faced by developers. One should keep in mind that a Design Pattern is not a complete solution, it only provides a general approach which can be used to design a particular solution.
Design Patterns can be thought of a template where a developer/designer can fit in code (object-oriented) to solve common problems.
Why are Design Patterns important?
To put it in simple words, Design Patterns make our life easier.
The biggest benefit of knowing and using Design Patterns is having a common vocabulary to talk about when discussing solutions. If you know how to implement a Design Pattern, let’s say Singleton Pattern, you basically know a solution before you start implementing.
It also makes the code more readable and maintainable. Several developers can modify/implement different programs in multiple ways. To have a standardized solution definitely saves time, requires less coding. Also, the solutions provided by Design Patterns are sound and reliable as they have been tested many times.
Word of caution:
Do not cram many design patterns in your code just because you know them. Try to find the optimal one, and not the only ones which you know/remember.
There can be different implementation of the same Design Pattern, so it might require analysis, knowledge and experience to decide when to use Design Patterns.
Overview
There are more than 50 identified Design Patterns. I will try to cover the most popular and important ones, and update the remaining Design Patterns later.
SDE-2 at Amazon
8 年Definitely Santanu Baruah. A long way to go.