Saturday, July 29, 2017

Design Patterns in Java

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 benefits 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.
§  Design patterns increase the re-usability of the code which makes it more robust and highly maintainable.

Design Patterns mainly divided 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:
3.      Abstract Factory Design Pattern

2.  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

3. Behavioral Design PatternBehavioral 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:
2.      Iterator Design Pattern
3.      Strategy Design Pattern
4.      Command Design Pattern
5.      Interpreter Design Pattern

Apart from above mentioned 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:
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


No comments:

Post a Comment