Design Patterns in Python
An Implementation of All 23 Object-Oriented Design Patterns
The importance of good design grows exponentially in the size of a codebase. Design choice (or lack thereof) regret is inevitable, it’s just a game of minimization. In the age of infinite free resources, the primary benefit of experience is the ability to architect solutions for longevity.
Heuristics like the SOLID Design Principles serve as great guiding principles, but we sometimes require more.
Gamma Categorisation
Design patterns are typically split into 3 categories (by intent) by the Gamma categorisation.
Creational Patterns
Concerned with the creation (construction) of objects. Building objects can become complex, these patterns define mechanisms to build objects in a scalable & reusable way.
Structural Patterns:
These patterns group objects & classes into large (organised) structures — maintaining flexibility, efficiency & reusability as these structures scale.
Behavioural Patterns:
Concerned with communication & assignment of responsibilities between objects, all remaining patterns are classified as Behavioural.
Code
All 23 design pattern implementations are available here.
Each file also contains a brief description of the intent and pros & cons of each design methodology. Happy architecting!