Code Pumpkin

Design Patterns

April 2, 2017
Posted by Dipen Adroja

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:

  1. 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:

    1. Singleton Design Pattern
    2. Factory Design Pattern
    3. Abstract Factory Design Pattern
    4. Builder Design Pattern
    5. Prototype Design Pattern
    6. Object Pool Design Pattern

  1. Structural Design Patterns:  Structural design patterns  provide different ways to create class structure. Some of the structural design patterns are as follow:

    1. Bridge Design Pattern
    2. Facade Design Pattern
    3. Proxy Design Pattern
    4. Composite Design Pattern
    5. Decorator Design Pattern
    6. ​Adapter Design Pattern

  1. 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:

    1. Mediator Design Pattern
    2. Iterator Design Pattern
    3. Strategy Design Pattern
    4. Command Design Pattern
    5. Interpreter Design Pattern
    6. Observer Design Pattern

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:

  1. Producer Consumer Design Pattern
  2. Leaders/followers pattern
  3. Read write lock pattern
  4. Balking pattern
  5. Scheduler pattern
  6. Thread pool pattern
  7. Barrier pattern
  8. Double-checked locking
  9. Guarded suspension pattern
  10. 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 🙂

If you like the content on CodePumpkin and if you wish to do something for the community and the planet Earth, you can donate to our campaign for planting more trees at CodePumpkin Cauvery Calling Campaign.

We may not get time to plant a tree, but we can definitely donate ₹42 per Tree.



About the Author


Coder, Blogger, Wanderer, Philosopher, Curious pumpkin



Tags: , , ,


Comments and Queries

If 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.
Total Posts : 124
follow us in feedly

Like Us On Facebook