15 Design Patterns in Simple Words

Written by Krunal Shah /

Design Patterns

Adapter

Convert the interface of a class to another interface that clients expect.

  • interface, class, conversion

Bridge

Decouple an abstraction from its implementation so that the two can vary independently.

  • implementation, abstraction, decoupling, independent variation

Observer

Notify multiple objects when the state of another object changes.

  • multiple objects, state change, notification

Decorator

Add behavior to an object dynamically without affecting the behavior of other objects.

  • object behavior, dynamic addition, no effect on other objects

Builder

Simplify the creation of complex objects with many optional parameters.

  • complex objects, optional parameters, simplified creation

Factory

Dynamically create objects based on input, configuration, or business rules.

  • object creation, dynamic, input, configuration, business rules

Template Method

Define the skeleton of an algorithm in a base class and let subclasses override specific steps.

  • algorithm, skeleton, base class, specific steps, subclass

Command

Encapsulate a request as an object and pass it to invokers to execute.

  • encapsulation, request, object, invokers, execution

Proxy

Control access to an object by creating a surrogate that handles the request.

  • access control, surrogate, request handling

Iterator

Traverse elements of a collection without exposing its underlying implementation.

  • collection, element traversal, implementation hiding

Facade

Provide a unified interface to a set of interfaces in a subsystem to simplify their usage.

  • simplified usage, subsystem, interface, unification

Composite

Compose objects into a tree structure to represent part-whole hierarchies.

  • tree structure, part-whole hierarchy, object composition

Flyweight

Share objects to support large numbers of fine-grained objects efficiently.

  • object sharing, fine-grained objects, efficiency

Visitor

Separate the algorithm from the object structure it operates on.

  • algorithm separation, object structure, operation

State

Alter an object's behavior when its state changes.

  • State change, notification