Design Patterns

Design patterns are solutions to specific problems that software developers face during software development, these patterns help the developers to have a cleaner and more extensible solution.


Below are the two main objective of Design Patterns :
  • Always program to an interface not an implementation
  • Always favor object composition over inheritance (More on this in my article section)

What is Gang of Four(GOF) ?

In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled Design Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development.

These authors are collectively known as Gang of Four (GOF). According to these authors design patterns are primarily based on the following principles of object orientated design.

So without wasting any more time, lets dive in with JDK based implementations of these object oriented design patterns.

Object Oriented Design Patterns:

Below is the tabulated list of design patterns used in the JDK-16 giving us an insight how the patterns are so popular.

Creational Design Patterns Structural Design Pattern Behavioral Design Pattern
Singleton Pattern Adapter Pattern Chain of Responsibility Pattern
Prototype Pattern Bridge Pattern Command Pattern
Builder Composite Interpreter pattern
Object Pool Pattern Decorator Pattern Iterator Pattern
Factory Pattern Facade Pattern Mediator Pattern
Factory Method Pattern Flyweight Pattern Memento Pattern
Abstract Factory Pattern Proxy Pattern Observer Pattern
State Pattern
Strategy Pattern
Template Pattern