This repository contains small educational Python examples that demonstrate common design patterns and a few related object-oriented programming exercises.
The examples are based on ideas and pattern exercises from Head First Design Patterns, adapted into Python for learning and practice. Most examples are standalone scripts that show the core idea of a pattern in a simple, readable way.
Included topics in this repository:
- Strategy
- Observer
- Decorator
- Factory
- Command
- Adapter
- Composite
- Facade
- Singleton
- Iterator
- Template Method
- State
- Proxy
- MVC
- Combined patterns example
There is also a small hash_map implementation with tests, which makes the repository useful not only for pattern study but also for basic data structure practice.
Use this project as a reference for:
- studying classic design patterns in Python
- reviewing object-oriented design ideas
- experimenting with small pattern implementations
- comparing different pattern structures in a single codebase
Most files can be run directly with Python, for example:
python strategy_pattern.py
python observer_pattern.py
python combined_patterns/main.py