DEV Community

Jasper Oh/YJ Oh
Jasper Oh/YJ Oh

Posted on

🧑‍🎨 Design Pattern (feat. C++)

Introduction to Design Patterns

In this blog series, we’ll explore a few widely used design patterns. As a reference, I’ll be using the Refactoring Guru website, which offers detailed explanations and adorable illustrations to help demystify design patterns.

What to Expect in This Series

1. How We Classify Design Patterns

Design patterns are typically divided into three main categories:

  • Behavioral Patterns:

    Focused on communication and interaction between objects.

    How do we enable objects to collaborate while minimizing dependencies?

  • Structural Patterns:

    Focused on designing architectures for flexibility and maintainability.

    How do we combine classes and objects to form robust program structures?

  • Creational Patterns:

    Focused on object creation mechanisms.

    What are the best strategies for instantiating objects or groups of objects?


2. Design Patterns Covered in This Series

I’ll structure this series by category, covering a mix of foundational and practical patterns.

Helper Concepts (💡 First)

Some useful ideas that support design patterns:

  • Wrapper (a concept similar to Structural Patterns)
  • Lazy Initialization (a concept similar to Creational Patterns)
  • Dependency Injection

Creational Patterns (🛠 Second)

Patterns that deal with object creation:

  • Singleton
  • Factory / Factory Method
  • Abstract Factory
  • Builder

Structural Patterns (🏗 Third)

Patterns that focus on the structure of objects:

  • Proxy
  • Facade
  • Bridge
  • Decorator

Behavioral Patterns (🔄 Last)

Patterns that handle communication between objects:

  • Observer
  • Chain of Responsibility
  • Strategy
  • State
  • Mediator

3. Cheat-Sheet for Interviews and Practical Use

To wrap things up, I’ll include a cheat-sheet summarizing key patterns. This will be helpful for preparing for technical interviews and as a quick reference when designing your own projects.

1. Behavioural

  • Singleton

Singleton

  • Chain of responsibility

Chain of responsibility

  • Strategy

Strategy

  • State

State

  • Mediator

Mediator

2. Structural

  • Proxy

Proxy

  • Facade

Facade

  • Bridge

Bridge

  • Decorator

Decorator

3. Creational

  • Observer

Observer

  • Factory <-> Factory Method

Factory

  • Abstract Factory

Abstract Factory

  • Builder

Builder

4. Helper Concept

  • Wrapper (More like Structural)

  • Lazy Initialization (More like Creational)

Lazy Initialization

  • Dependency Injection

Top comments (0)