What are design patterns in OOP?

Why Interviewers Ask This

This is a classic screening question for OOP Concepts roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

Design patterns are proven, reusable solutions to commonly occurring problems in software design. They are general templates, not specific code — they must be adapted to each situation. Documented by the "Gang of Four" (GoF) in their 1994 book. Three categories: (1) Creational patterns — deal with object creation mechanisms: Singleton: ensure only one instance; Factory Method: define interface for object creation; Abstract Factory: create families of related objects; Builder: construct complex objects step by step; Prototype: copy existing objects; (2) Structural patterns — deal with object composition: Adapter: make incompatible interfaces work together; Decorator: add behavior dynamically; Facade: simplified interface to complex subsystem; Composite: tree structure of objects; Bridge: separate abstraction from implementation; Proxy: placeholder for another object; (3) Behavioral patterns — deal with communication between objects: Observer: notify dependents of state changes; Strategy: define family of algorithms, make them interchangeable; Command: encapsulate request as object; Iterator: traverse collection without exposing structure; Template Method: define algorithm skeleton, let subclasses fill in steps; State: object changes behavior with state; Chain of Responsibility. Why use patterns? Shared vocabulary, proven solutions, faster communication ("use Observer here"), avoid reinventing the wheel, flexible extensible code.

Pro Tip

Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a OOP Concepts codebase.