Updated on 30 Jun, 20267 mins read 1,247 views

Imagine you are building software for ten years.

You design:

  • Payment systems
  • Notification systems
  • Inventory systems
  • Banking systems
  • Messaging systems
  • E-commerce systems

After a while, you start noticing something interesting.

The problems are different.

But the solution often look similar.

Example:

You need:

One object shared globally

You solve it.

Years later:

Different project.

Same problem.

Same solution.

Again:

Different project.

Same problem

Same solution.

Eventually software engineers realized:

Many design problems repeat.

And many good solutions repeat.

These recurring solutions became known as: Design Patterns

Historical Background

The idea of patterns did not originate in software.

It came from architecture.

Architect: Christopher Alexander

observed that successful buildings often reused similar design solutions.

Example:

A town square
A courtyard
A garden
A window arrangement

Different buildings.

Same design ideas.

He documented these recurring solutions in:

A Pattern Language

Software engineers later realized:

Software design has recurring solutions too.

This led to the famous book:

Design Patterns

written by:

  • Erich Gamma
  • Richard Helm
  • Ralph Johnson
  • John Vlissides

Published in 1994.

This book changed software engineering forever.

What Is a Design Pattern?

A design pattern is:

A proven, reusable solution to a recurring design problem in a specific context.

Notice:

It is NOT:

Reusable Code

It is:

Reusable Design

Pattern vs Code

Suppose you learn:

Factory Pattern

There is no single Factory code.

Instead:

The pattern described:

Problem
Context
Participants
Interactions
Trade-offs

You implement it differently every time.

Just like:

Recipe

is not:

Finished Food

Real-World Analogy

Imagine traffic lights.

Problem:

Vehicles Need to Coordinate

Solution:

Traffic Signal

This solution works in:

  • Delhi
  • London
  • New York

Different cities.

Same pattern.

Buy Me A Coffee

Leave a comment

Your email address will not be published. Required fields are marked *