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.
Each file can be executed directly:
python3 factory_registry.py
python3 observer_before.py
python3 singleton.pyEach example includes its own comments, output, and short history for easy understanding without any additional setup.
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.
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.
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.