Python Design Patterns - Introduction
Design patterns are used to represent the pattern used by developers to create software or web application. These patterns are selected based on the requirement analysis. The patterns describe the solution to the problem, when and where to apply the solution and the consequences of the implementation.
Structure of a design pattern
The documentation of design pattern is maintained in a way that focuses more on the technology that is used and in what ways. The following diagram explains the basic structure of design pattern documentation.
It describes the pattern in short and effective manner.
It describes what the pattern does.
It describes the list of situations where pattern is applicable.
Participants and consequences
Participants include classes and objects that participate in the design pattern with a list of consequences that exist with the pattern.
Python is an open source scripting language. It has libraries that support a variety of design patterns. The syntax of python is easy to understand and uses English keywords.
Python provides support for the list of design patterns that are mentioned below. These design patterns will be used throughout this tutorial −
- Model View Controller Pattern
- Singleton pattern
- Factory pattern
- Builder Pattern
- Prototype Pattern
- Facade Pattern
- Command Pattern
- Adapter Pattern
- Prototype Pattern
- Decorator Pattern
- Proxy Pattern
- Chain of Responsibility Pattern
- Observer Pattern
- State Pattern
- Strategy Pattern
- Template Pattern
- Flyweight Pattern
- Abstract Factory Pattern
- Object Oriented Pattern
Benefits of using design pattern
Following are the different benefits of design pattern −
Patterns provide developer a selection of tried and tested solutions for the specified problems.
All design patterns are language neutral.
Patterns help to achieve communication and maintain well documentation.
It includes a record of accomplishment to reduce any technical risk to the project.
Design patterns are highly flexible to use and easy to understand.