The design patterns is a general repeatable solution to a commonly occurring problem in software design.
These are the well-proven solutions for solving the specific problem/task.
Uses of Design Patterns
Design patterns are a toolkit of tried and tested solutions to common problems in software design. It teaches you how to solve all sorts of problems using principles of object-oriented design.
It define a common language that you and your teammates can use to communicate more efficiently. You can say, “Oh, just use a Singleton for that,” and everyone will understand the idea behind your suggestion.
Advantages of Design Patterns
- They are reusable in multiple projects.
- They provide transparency to the design of an application.
- It provide the solutions that help to define the system architecture.
- It capture the software engineering experiences.
- Patterns are the well-proved solutions for solving the specific problem/task.

What all design patterns are used in Java?
Design patterns differ by their complexity, level of detail, and scale of applicability to the entire system being designed. The most basic and low-level patterns are often called idioms. They usually apply only to a single programming language.
The most universal and high-level patterns are architectural patterns. Developers can implement these patterns in virtually any language.
Design Patterns are divided into three categories – Creational, Structural, and Behavioral design patterns.
Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code.
How many types of creational patterns are there?
- Abstract Factory Design Pattern
- Creates an instance of several families of classes.
- Builder Design Pattern
- Separates object construction from its representation.
- Factory Method Design Pattern
- Creates an instance of several derived classes.
- Object Pool Design Pattern
- Avoid expensive acquisition and release of resources by recycling objects that are no longer in use.
- Prototype Design Pattern
- A fully initialized instance to be copied or cloned.
- Singleton Design Pattern
- A class of which only a single instance can exist.
Structural Design Patterns
The structural pattern explains how to assemble objects &classes into larger structures with keeping the structures flexible and efficient.
- Adapter Design Pattern
- Match interfaces of different classes
- Bridge Design Pattern
- Separates an object’s interface from its implementation
- Composite Design Pattern
- A tree structure of simple and composite objects
- Decorator Design Pattern
- Add responsibilities to objects dynamically
- Facade Design Pattern
- A single class that represents an entire subsystem
- Flyweight Design Pattern
- A fine-grained instance used for efficient sharing
- Private Class Data Design Pattern
- Restricts accessor/mutator access
- Proxy Design Pattern
- An object representing another object
Behavioral design patterns
Behavioral patterns take care of effective communication and the assignment of responsibilities between objects.
- Chain of responsibility
- A way of passing a request between a chain of objects
- Command
- Encapsulate a command request as an object
- Interpreter
- A way to include language elements in a program
- Iterator
- Sequentially access the elements of a collection
- Mediator
- Defines simplified communication between classes
- Memento
- Capture and restore an object’s internal state
- Null Object
- Designed to act as a default value of an object
- Observer
- A way of notifying change to a number of classes
- State
- Alter an object’s behavior whenever its state changes
- Strategy
- Encapsulates an algorithm inside a class
- Template method
- Defer the exact steps of an algorithm to a subclass
- Visitor
- Defines a new operation to a class without change