Modèles de conception en Python: introduction
What is a design pattern?
Design patterns are widely accepted solutions to recurring problems.
Why do we need them?
Reusing these patterns saves our time to reinvent the wheel and encourage us to adopt the best practices.
Facts about design patterns
- language-neutral
- dynamic
- intentionally incomplete for possible customization
Three major design patterns
- Creational : Polymorphism
- Structural : Inheritance
- Behavioral : Methods and their signatures
Polymorphism:
- relies on inheritance
- Allows child classes to be instantiated and treated as the same type as its parent
- Enables a parent class to be manifested into any of its child classes
A Pattern Context
- Participants: classes
- Quality attributes: Usability, modifiability, reliability, etc
- Forces: various factors or trade-offs to consider
- Consequences: side effects
Pattern Language
- Name: should be meaningful and memorable
- Context
- Problem
- Solution: Structure: relationships among elements; Behavior: interactions
- Related patterns
Links
Creational Patterns
Structural Patterns
[Behavioral Patterns]
(https://qiita.com/Violet_Bing/items/7d10b9c71dcc70aae430)
To be continued...