Skip to content

mjftw/design-patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Example Design Patterns with Python

Example design patterns implemented in python, some written while reading Head First Design Patterns and others added later.

The patterns

Currently implemented:

  • Interface
  • Command
  • Decorator
  • Factory
  • Abstract Factory
  • Iterator
  • Remote Proxy
  • Singleton
  • Observer

Running the examples

Example scripts exist for some of the patterns which show it working in an unrealistic real world example.

To run the examples for each of the patterns do:

python3 -m example-design-patterns.<name_of_pattern>
# E.g. run the interface example
python3 -m example-design-patterns.interface

Running the tests

It is recommended that you first install the package requirements into a virtualenv file

# Create and activate the venv
python3 -m virtualenv venv
. venv/bin/activate

# Install required packages into venv
python3 -m pip install -r requirements.txt

The project uses pytest to run the tests, you can therefore run them with:

python3 -m pytest

About

Example Design Patterns with Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages