Design Patterns interview question · Most asked

What are the three categories of Gang of Four design patterns?

Summary

Creational patterns deal with object creation (Factory Method, Abstract Factory, Builder, Prototype, Singleton), structural patterns with composing objects (Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy), and behavioral patterns with how objects communicate and share responsibilities (Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor, Interpreter).

Longer Answer

The 23 classic patterns split 5 / 7 / 11 across the three families. A quick way to remember them: creational answers "how do I create objects flexibly?", structural answers "how do I fit objects together?", and behavioral answers "how do objects divide work and talk to each other?".

Modern codebases add patterns beyond the original 23, such as dependency injection, repository, middleware and pub/sub, which build on the same ideas.

Key Points

  • Creational: 5 patterns about creating objects.
  • Structural: 7 patterns about composing objects.
  • Behavioral: 11 patterns about communication and responsibility.

Deep dive: Design Patterns, Explained Simply: What a Design Pattern Is

Explanation

What interviewers look for

Correct grouping with a couple of examples in each, ideally with the one-line question each family answers.

Follow-up questions

  • Which family does Decorator belong to, and why?
  • Which patterns from each family have you used?

More most-asked Design Patterns questions

← All Design Patterns questions