Skip to content

A collection/cheatsheet of different software patterns implemented in Python.

Notifications You must be signed in to change notification settings

HuberNicolas/design-patterns-cheatsheet

Repository files navigation

Design Patterns

Note: All descriptions are provided without warranty.

Behavioural Patterns

  • Iterator
    • Description: Provides a way to access elements of an aggregate object sequentially without exposing its underlying structure.
  • Observer
    • Description: Defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically.
  • Strategy
    • Description: Enables a family of algorithms to be defined, encapsulated, and interchangeable at runtime, allowing the client to choose the desired algorithm.

Creational Patterns

  • Builder
    • Description: Separates the construction of an object from its representation, allowing the same construction process to create different representations.
  • Factory
    • Description: Provides an interface for creating objects, but allows subclasses to decide which class to instantiate.
  • Singleton
    • Description: Ensures that only one instance of a class is created and provides a global point of access to it.

Structural Patterns

  • Adapter
    • Description: Converts the interface of one class into another interface that clients expect, allowing classes to work together that couldn't otherwise due to incompatible interfaces.
  • Decorator
    • Description: Adds behavior to an object dynamically, without affecting the behavior of other objects of the same class.
  • Facade
    • Description: Provides a simplified interface to a complex subsystem, making it easier to use and reducing dependencies.

Abstract Classes vs. Interfaces

  • Description: Demonstrates the difference between abstract classes and interfaces, which are used for defining contracts and providing common behavior in object-oriented programming.

Sources/References:

About

A collection/cheatsheet of different software patterns implemented in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages