Design Patterns is general repeatable solution to a commonly occurring problem in software design. Rather we should call it a solution template as it will provide the standard to implement the solution not the code directly.
In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides (known as Gang of Four) published a book titled Design Patterns – Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development.
Below are some of the benifits listed for using Design Patterns:
- If we use the design pattern sensibly, it saves time as design patterns are already defined and provide industry standard approach to solve recurring problems.
- As it is predefined, it makes code easy to understand and fast to develop.
- Design patterns have been evolved over a long period of time and they provide best solutions to certain problems faced during software development. Learning these patterns helps unexperienced developers to learn software design in an easy and faster way.
- Desing patterns increase the re-usability of the code which makes it more robust and highly maintanable.
Design Patterns mainly devided into three categories in Java:
- Creational Design Patterns: Creational design patterns deal with the creation of object in the best possible way in the specific situation. Some of the creational design patterns are as follow:
Structural Design Patterns: Structural design patterns provide different ways to create class structure. Some of the structural design patterns are as follow:
- Bridge Design Pattern
- Facade Design Pattern
- Proxy Design Pattern
- Composite Design Pattern
- Decorator Design Pattern
- Adapter Design Pattern
- Behavioral Design Pattern: Behavioral design patterns provide solution for the bettern interaction between objects and how to provide loose couplings and flexibility to extend. Some of the behavioral design patterns are as follow:
Apart from above mentoined three main types, There are some design patterns that deals with multi-threaded programming paradigm. Those are known as Concurrency Design Patterns. Some of the concurrency design patterns are as follow:
- Producer Consumer Design Pattern
- Leaders/followers pattern
- Read write lock pattern
- Balking pattern
- Scheduler pattern
- Thread pool pattern
- Barrier pattern
- Double-checked locking
- Guarded suspension pattern
- Reactor pattern
Above mentioned design patterns are not the only available patterns. These are more frequently used.
The concept of design patterns has been criticized in several ways. As the right usage of, right design pattern at right place, in right context give the advantages if the above conditioned not satified and worng pattern is been used then it creates mess for the design. So it is atmost important task to choose the right design pattern for specific situations.
In the subsequent article we will go throuh some of the design patterns.
That's all for this topic. If you guys have any suggestions or queries, feel free to drop a comment. We would be happy to add that in our post. You can also contribute your articles by creating contributor account here.
Happy Learning 🙂
Comments and QueriesIf you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code class="java"> String foo = "bar"; </code></pre>For more information on supported HTML tags in disqus comment, click here.