Skip to content

shoyebinamdar/design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

design-patterns

Creational Design Pattern

Singleton :- The Singleton Design Pattern aims to keep a check on initialization of objects of a particular class by ensuring that only one instance of the object exists throughout the Java Virtual Machine.

Factory:- This pattern “defines an interface for creating an object, but let subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses”.

Abstract Factory:- Provides an interface for creating families of related or dependent objects without specifying their concrete classes.

Builder:- When the complexity of creating object increases, the Builder pattern can separate out the instantiation process by using another object (a builder) to construct the object.

Object Pool:- Object pool pattern is a software creational design pattern which is used in situations where the cost of initializing a class instance is very high.

Prototype:- A prototype is a template of any object before the actual object is constructed. In java also, it holds the same meaning. Prototype design pattern is used in scenarios where application needs to create a number of instances of a class, which has almost same state or differs very little.

Structural Design Patterns

Adapter:- The Adapter pattern is used for connecting two incompatible interfaces that otherwise cannot be connected directly. An Adapter wraps an existing class with a new interface so that it becomes compatible with the interface needed.

Bridge:- decouple an abstraction from its implementation so that the two can vary independently. This means to create a bridge interface that uses OOP principles to separate out responsibilities into different abstract classes.

Decorator:- This pattern is useful for enhancing the behavior of an object.

Proxy Pattern:- With this pattern, we create an intermediary that acts as an interface to another resource, e.g., a file, a connection. This secondary access provides a surrogate for the real component and protects it from the underlying complexity.

Facade:- A single class that represents an entire subsystem.

Flyweight:- A fine-grained instance used for efficient sharing.

Behavioral Design Pattern

Chain of Responsibility:- Chain of responsibility pattern is used to achieve loose coupling in software design where a request from the client is passed to a chain of objects to process them. Later, the object in the chain will decide themselves who will be processing the request and whether the request is required to be sent to the next object in the chain or not.

Command:- Chain of responsibility pattern is used to achieve loose coupling in software design where a request from the client is passed to a chain of objects to process them. Later, the object in the chain will decide themselves who will be processing the request and whether the request is required to be sent to the next object in the chain or not.

Iterator Pattern:- The iterator pattern provides a way to access the elements of an aggregate object without exposing its underlying representation.

Observer Pattern:- The Observer Pattern defines a one to many dependency between objects so that one object changes state, all of its dependents are notified and updated automatically.

State:- State design pattern is used when an Object changes its behavior based on its internal state.

Strategy:- The strategy pattern (also known as the policy pattern) is a software design pattern that enables an algorithm’s behavior to be selected at runtime.

Visitor:- Defines a new operation to a class without change.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages