Design Patterns

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.

Design Principles

  • 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 Each branch is a different design pattern.

Go to your working directory and then follow below steps:

  1. git clone
  2. 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.

Creational Patterns:

  • Singleton:
    • 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.
  • Prototype:
    • This article helps understand prototype design pattern implementation using java with the help of cloneable interface in java.
  • Builder:
    • The article describes builder design pattern and illustrates it with detailed and simple example. Diagram for bulider design pattern is explained in detail.

Behavioral Patterns:

  • Chain Of Responsibilities:
    • This article illustrates chain of responsibilities pattern implementation with the help of simple example and self explanatory class diagram.
  • Command:
    • The article helps understand command design pattern implementation in java and elaborates with self explanatory class diagram for both pattern and example.
  • Mediator
    • The article helps understand mediator design pattern implementation with the help of its generic diagram and a simple example of chat application.
  • Observer:
    • 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
  • Visitor:
    • This article provides visitor design pattern implementation along with a generic class diagram and example class diagram.
  • State:
    • The article gives a very interesting example of battle game soldiers and tries to explain state design pattern implementation along with class diagram


Structural Patterns:

  • Adapter:
    • This article helps us understand adapter design pattern implementation with the help of a generic class diagram and another with a simple example
  • Bridge:
    • The article helps understand bridge design pattern implementation with self explanatory generic as well as example class diagram.
  • Composite:
    • Provides composite design pattern implementation with the help of generic as well as example class diagram and easy to understand example
  • Decorator:
    • 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
  • Facade:
    • The article helps understand facade design pattern conceptually and with the help of class diagram and real life coding example.
  • Memento:
    • 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.
The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *