/Design-Patterns

Collection of some Design Patterns examples implemented in Python.

Primary LanguagePython

Design Patterns

A reusable solution to a problem identified in software design.

  • Creational Pattern: Design patterns that involve instantiating concrete objects.
  • Structural Pattern: Design patterns that describe how objects are connected to one another.
  • Behavioural Pattern: Design patterns that focus on ways that individual objects collaborate to achieve a common goal.

Creational Pattern

  • Singleton Pattern: A creational pattern, in which there is only one object of a class.
  • Factory Pattern: A creational pattern, which uses a factory method in the same class to create objects.

Structural Pattern

  • Facade pattern: The façade design pattern is a structural pattern used to provide a single, simplified interface for client classes to interact with a subsystem.
  • Adpter Pattern: A structural pattern that facilitates communication between two existing systems by providing a compatible interface.
  • Composite Pattern: A structural pattern used to achieve two goals: to compose nested structures of objects, and to deal with the classes for these objects uniformly.
  • Proxy Pattern: A design pattern allows a proxy class to represent a real subject class
  • Decorator Pattern: A structural pattern that allows additional behaviours or responsibilities to be dynamically attached to an object, through the use of aggregation to combine behaviours at run time.

Behavioural Pattern

  • Template Method Pattern: A behavioural design pattern that defines an algorithm’s steps generally, deferring the implementation of some steps to subclasses. In other words, it is concerned with the assignment of responsibilities.
  • Chain of Responsibility Pattern: A design pattern that is a chain of objects responsible for handling requests.
  • State Pattern: A behavioural design pattern that can occur as objects in your code are aware of their current state, and thus can choose an appropriate behaviour based on their current state. When the current state changes, this behaviour can be altered.
  • Command Pattern: A behavioural pattern for encapsulating requests as objects.
  • Observer Pattern: A behavioral​ pattern​ for​ event handling.