Skip to content

A complete, modern Python collection of all 23 Gang of Four Design Patterns — with real use cases, alternatives, and clean examples.

Notifications You must be signed in to change notification settings

my-how-to/Design-Patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Design Patterns — Educational Examples

This repository contains simple, well-commented examples of classic Object-Oriented Design Patterns implemented in Python. Each pattern demonstrates how developers solved common software design problems — first before the pattern existed, and then using the pattern approach.


How to Run

Each file can be executed directly:

python3 factory_registry.py
python3 observer_before.py
python3 singleton.py

Each example includes its own comments, output, and short history for easy understanding without any additional setup.


Educational Approach

Every pattern pair follows this format:

  • Before Version: shows the repetitive or rigid code used before the pattern.
  • Pattern Version: shows the structured, reusable solution.
  • Commented Code: clear, consistent style for all files.
  • Example Output: visible directly inside the script.

Disclaimer

These code examples are simplified educational demonstrations meant for learning purposes. They are not production-ready implementations and should not be used without proper error handling, testing, and optimization.


Author

Alexandru Petrenco Educational repository built with AI assistance from OpenAI GPT-5. Part of a personal study collection on Object-Oriented Programming and Software Design Patterns.

Releases

No releases published

Packages

No packages published

Languages