Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.2 KB

File metadata and controls

44 lines (33 loc) · 1.2 KB

Python Design Patterns

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.

Purpose

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

Running examples

Most files can be run directly with Python, for example:

python strategy_pattern.py
python observer_pattern.py
python combined_patterns/main.py