Design Pattern

A design pattern in software development is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be directly transformed into code, but rather a template that provides guidance on how to solve a particular problem in a way that has been proven effective over time.

Naval Kishor

10/12/20241 min read

photo of white staircase
photo of white staircase

1. Creational Patterns

Focus on object creation mechanisms.

  • Singleton Patterns

    Ensures a class has only one instance and provides a global point of access to it.

  • Factory Patterns

    Defines an interface for creating objects, but lets subclasses alter the type of objects that will be created.

  • Builder Patterns

    Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.

2. Structural Patterns

Deal with object composition and the relationships between entities.

  • Adapter

    Allows incompatible interfaces to work together by wrapping one interface with another.

  • Decorator

    Adds new functionality to an object dynamically without altering its structure.

  • Facade

    Provides a simplified interface to a complex subsystem.

3. Behavioral Patterns

Focus on communication between objects and the flow of control in a system.

  • Observer

    Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified automatically.

  • Strategy

    Enables selecting an algorithm's behavior at runtime, by defining a family of algorithms, encapsulating each one, and making them interchangeable.

  • Command

    Encapsulates a request as an object, thereby allowing for parameterization of clients with queues, requests, and operations.