prashant-gaur / cc_design_patterns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Design Patterns

Divided into 3 categories based on objectives

1. Creational Patterns - Creation of objects

2. Structural Patterns - Assembly of objects

3. Behavioral Patterns - Interactions between objects

Creational Patterns

Singelton

When a single instance of a class is needed.

For example - Logger, Database

Factory Method

Decouple object creation from usage.

For example - Create different types of database connections based on configuration

Abstract Factory

Create families of related objects.

For example - Build parsers for different file formats (e.g. JSON, XML, CSV).

Builder

Constructing complex objects step by step.

Prototype

A partially or fully initialized object that you copy(clone) and make use of.

For example - Creating duplicate objects and reusing cached objects to reduce database calls.
Requires deep copy support.

Structural Patterns

About


Languages

Language:C++ 100.0%