A design pattern provides a general reusable solution for the common problems occurs in software design.
1. Factory Method:
Define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate
2. Abstract Factory:
Define an interface or abstract class for creating families of related (or dependent) objects but without specifying their concrete sub-classes
1. Adapter:
Adapting an interface into another according to client expectation.
Design Patterns are programming language independent strategies for solving a common problem. that means a design pattern represents an idea, your code more flexible, reusable and maintainable 🍥.
Creational design patterns :
creational design patterns are concerned with the ways of creating an object.
1. Factory Method:
Define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate
Define an interface or abstract class for creating families of related (or dependent) objects but without specifying their concrete sub-classes
3. Builder:
Construct a complex object from simple objects using a step-by-step approach
4. Object Pool:
Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
5. Prototype:
A fully initialized instance to be copied or cloned
Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
5. Prototype:
A fully initialized instance to be copied or cloned
6. Singleton:
A class of which only a single instance can exist
A class of which only a single instance can exist
Structural patterns:
Structural Design Patterns are Design Patterns that ease the design by identifying a simple way to realize relationships between entities.Adapting an interface into another according to client expectation.
2. Bridge:
Separates an object's interface from its implementation.
Separates an object's interface from its implementation.
3. Composite:
Allowing clients to operate on a hierarchy of objects.
4. Decorator:
Add responsibilities to objects dynamically.
Add responsibilities to objects dynamically.
5. Facade:
A single class that represents an entire subsystem, Providing an interface to a set of interfaces.
A single class that represents an entire subsystem, Providing an interface to a set of interfaces.
6. Flyweight:
Reusing an object by sharing it.
Reusing an object by sharing it.
8. Proxy:
An object representing another object.
An object representing another object.
Behavioral Design Patterns
Behavioral design patterns are concerned with the interaction and responsibility of objects. the interaction between the objects should be in such a way that they can easily talk to each other and still should be loosely coupled.
1. Chain of responsibility:
A way of passing a request between a chain of objects.
2. Command:
Encapsulate a command request as an object.
Encapsulate a command request as an object.
3. Interpreter:
A way to include language elements in a program.
A way to include language elements in a program.
4. Iterator:
Sequentially access the elements of a collection.
Sequentially access the elements of a collection.
5. Mediator:
It defines simplified communication between classes.
It defines simplified communication between classes.
6. Memento:
Capture and restore an object's internal state.
Capture and restore an object's internal state.
7. Null Object:
Designed to act as a default value of an object.
Designed to act as a default value of an object.
8. Observer:
A way of notifying change to a number of classes.
A way of notifying change to a number of classes.
9. State:
Alter an object's behavior when its state changes.
Alter an object's behavior when its state changes.
10. Strategy:
Encapsulates an algorithm inside a class.
Encapsulates an algorithm inside a class.
11. Template method:
Defer the exact steps of an algorithm to a subclass.
Defer the exact steps of an algorithm to a subclass.
12. Visitor:
Defines a new operation to a class without change.
Defines a new operation to a class without change.
Comments
Post a Comment