Design Patterns in Python
What are design patterns btw?
Well, a design pattern is how you design your project architecture to be as efficient as possible. Design patterns gives an efficent way to solve common problems that might occur during the life cycle of a project.
Design patterns are language independent, programming strategy to solve common problems
Its a common practice adopted by experiance programmers to provide well tested and efficent framework for solving a problem.
Types of design patterns:
- Creational
- Structural
- Behavioral
Creational:
Creational design pattern deals with object and class creation. It can be further classified into :
- Class Creational patterns:
- Which deals with how to use inheritance efficently
- Object Creational patterns:
- Which deals with how to deal with objects and delegation.
Crearional patterns includes:
- Factory Method
- Abstract Factory
- Builder Method
- Singleton Pattern
- Object Pool
- Prototype Pattern
Structural:
As the name suggests, these are used to maintain and organizing classes and structures to forms a large structure. Structural object-patterns define ways to compose objects to obtain new functionality.
Structural patterns includes:
- Adapter
- Bridge
- Composit
- Private class data
- Proxy
- Decorator
- Facade
Behavioral:
These design patterns are all about Class’s objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.
- Chain of responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Null Object
- Observer
- State
- Strategy
- Template method
- Visitor