Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 2.41 KB

File metadata and controls

29 lines (26 loc) · 2.41 KB

Design Patterns Tasks

Creational Patterns

  • Singleton - Ensures a class has only one instance and provides a global access point to it.
  • Factory Method - Defines an interface for creating objects but lets subclasses decide which class to instantiate.
  • Abstract Factory - Provides an interface for creating families of related objects without specifying their concrete classes.
  • Builder - Separates complex object construction from its representation, allowing step-by-step construction.
  • Prototype - Creates new objects by copying existing instances (cloning).

Behavioral Patterns

  • Observer - Defines a one-to-many dependency where when one object changes state, all dependents are notified.
  • Chain of Responsibility - Passes requests along a chain of handlers where each handler decides to process or pass the request.
  • Command - Encapsulates a request as an object, allowing parameterization and queuing of requests.
  • Iterator - Provides sequential access to elements without exposing underlying representation.
  • Mediator - Defines an object that encapsulates how objects interact, promoting loose coupling.
  • Memento - Captures and externalizes an object's internal state for later restoration without violating encapsulation.
  • State - Allows an object to alter its behavior when its internal state changes.
  • Strategy - Defines a family of algorithms, encapsulates each one, and makes them interchangeable.
  • Template Method - Defines the skeleton of an algorithm in a base class, letting subclasses override specific steps.
  • Visitor - Separates algorithms from the objects they operate on, allowing new operations without modifying classes.

Communications Patterns (Structural)

  • Adapter - Converts one interface into another that clients expect, allowing incompatible interfaces to work together.
  • Bridge - Separates abstraction from implementation so they can vary independently.
  • Composite - Composes objects into tree structures to represent part-whole hierarchies, treating individual objects and compositions uniformly.
  • Decorator - Adds new functionality to objects dynamically without altering their structure.
  • Facade - Provides a simplified interface to a complex subsystem.
  • Flyweight - Shares common state between multiple objects to save memory.
  • Proxy - Provides a surrogate or placeholder to control access to another object.