Patterns

What is a Pattern?

A pattern is a reusable solution that can be applied to commonly occurring problems in software design. Another way of looking at patterns is as templates for how we solve problems - ones that can be used in quite a few different situations.

Design patterns have three main benefits:

  1. Patterns are proven solutions: They provide solid approaches to solving issues in software development using proven techniques that reflect the experience and insights the developers that helped define them bring to the pattern.

  2. Patterns can be easily reused: A pattern usually reflects an out of the box solution that can be adapted to suit our own needs. This feature makes them quite robust.

  3. Patterns can be expressive: When we look at a pattern there’s generally a set structure and vocabulary to the solution presented that can help express rather large solutions quite elegantly.

Categories Of Design Patterns

Creational Design Patterns focus on handling object creation mechanisms where objects are created in a manner suitable for the situation we're working in. The basic approach to object creation might otherwise lead to added complexity in a project whilst these patterns aim to solve this problem by controlling the creation process.

  • Constructor

  • Factory

  • Abstract Factory

  • Prototype

  • Singleton

  • Builder

Structural Design Patterns are concerned with object composition and typically identify simple ways to realize relationships between different objects. They help ensure that when one part of a system changes, the entire structure of the system doesn't need to do the same. They also assist in recasting parts of the system which don't fit a particular purpose into those that do.

  • Decorator

  • Facade

  • Flyweight

  • Adapter

  • Proxy

  • Bridge

  • Composite

Behavioral Design Patterns focus on improving or streamlining the communication between disparate objects in a system.

  • Iterator

  • Interpreter

  • Template Method

  • Chain of Responsibility

  • Command

  • Mediator

  • Memento

  • Observer

  • Visitor

  • State

  • Strategy

Last updated

Was this helpful?