Skip to content
BENIBIX Learn

Design Pattern

Development🏗️ ArchitectureDesign Patterns

Also known as Design Patterns, Software Design Pattern, Gang of Four Patterns

A known way to solve a problem that keeps coming up in code.

Think of it like

Think of it like a recipe card. Many cooks have made the dish, so you follow the tried way.

Example

Lucy needs many parts of her app to update when a setting changes. A teammate says use the observer pattern, and she knows the shape at once.

Why it matters

Patterns give teams shared words for designs. They also save you from solving a solved problem badly.

Definition

A design pattern is a known answer to a problem that comes up again and again in code. It is not code you copy, but a shape you follow and fit to your case. Each pattern has a name, so a team can say observer instead of explaining the idea each time. The 1994 book by the Gang of Four listed 23 of them. Many are now built into languages and frameworks.

Common mistake

Forcing patterns into code that does not need them. Use one when the problem it solves is really there.

Key takeaways

  1. 1
    A known answer. To a common problem.
  2. 2
    A shape, not code. Fit it to your case.
  3. 3
    Shared names. Faster team talk.