This page has a list of popular design patterns. Instead of directly going to design patterns, it starts from core design principles which makes them easy to understand. Design principles and Design Patterns help us build extensible, scalable and maintainable applications.
As we all know, there can be multiple opinions and solutions for a specific pattern, I would like you to comment any suggestions and feedback. It would be great help for all of us.
- The Open Closed Principle
- The article describes the open closed principle which is one of the object oriented design principles.
- Don’t Repeat Yourself
- The article explains and demonstrates don’t repeat yourself principle with the help of a real life example
- Single Responsibility Principle
- The article explains the concept of single responsibility principle with the help of an example and how to identify and apply it to code
- Liskov Substitution Principle
- The article explains how violation of liskov substitution principle happens while designing applications and how to solve it using delegation
- Aggregation Example
- An example of aggregation association is provided with clear explaination of the concept
- Composition Example
- Concept of composition is explained using simple real life example along with corresponding java classes.
Design Pattern Implementations:
If you have git installed, then you can directly clone the design-patterns repository. I have kept code for all design patterns at https://github.com/theJavaGeek/design-patterns. Each branch is a different design pattern.
Go to your working directory and then follow below steps:
- git clone https://github.com/theJavaGeek/design-patterns.
- cd design-patterns
Now you have checked out master branch. There is nothing in it though. You can checkout each design pattern by each branch name. For example, if you want to checkout command pattern, then simply do git checkout command.
- The article gives singleton design pattern implementation using enums in java. It explains advantages of enums demonstrates with simple example
- Factory Method :
- The article provides factory method implementation as defined by GoF and Head First Design Patterns book. It elaborates factory method with concrete example
- Abstract Factory:
- The article gives abstract factory pattern implementation in java with comprehensive definition and example. It is elaborate with lucid example and diagrams.
- This article helps understand prototype design pattern implementation using java with the help of cloneable interface in java.
- The article describes builder design pattern and illustrates it with detailed and simple example. Diagram for bulider design pattern is explained in detail.
- Chain Of Responsibilities:
- This article illustrates chain of responsibilities pattern implementation with the help of simple example and self explanatory class diagram.
- The article helps understand command design pattern implementation in java and elaborates with self explanatory class diagram for both pattern and example.
- The article helps understand mediator design pattern implementation with the help of its generic diagram and a simple example of chat application.
- The article provides a short and real life example of observer pattern implementation along with elaborate diagram for both design pattern and example.
- Strategy :
- The article provides strategy pattern implementation along with definition and a simple example.Class diagram for pattern as well as example is demonstrated
- Template Method :
- This article helps understand template method implementation with a simple example along with generic class diagram with everyday life example
- This article provides visitor design pattern implementation along with a generic class diagram and example class diagram.
- The article gives a very interesting example of battle game soldiers and tries to explain state design pattern implementation along with class diagram
- This article helps us understand adapter design pattern implementation with the help of a generic class diagram and another with a simple example
- The article helps understand bridge design pattern implementation with self explanatory generic as well as example class diagram.
- Provides composite design pattern implementation with the help of generic as well as example class diagram and easy to understand example
- The article covers yet another creational design pattern. It gives decorator pattern implementation in java along with class diagram and its example
- Flyweight :
- This article helps understand flyweight design pattern implementation and elaborates it with simple example along with its class diagram
- The article helps understand facade design pattern conceptually and with the help of class diagram and real life coding example.
- This article gives an interesting example of memento design pattern implementation along with its generic class diagram and elaborate example.
- Proxy :
- proxy design pattern implementation is explained thoroughly in this article with the help of simple generic class diagram and separate for example.
Latest posts by Prasad Kharkar (see all)
- Using PrimeNG themes with angular apps - August 20, 2017
- Using primeng with angular 4 - July 31, 2017
- CRUD application using angular 4 spring rest services spring data jpa - June 16, 2017