C++ – Design Patterns and Idioms (CPP3)

Programming, C, C++

Modern C++ lets you write reusable components and compose them through clear interfaces. It combines classic OOP — inheritance and polymorphism — with extensive compile-time techniques, offering many well-established idioms and proven design patterns.

The course shows how recent standards improve readability and enable compile-time optimization for better performance. It is updated for C++20, C++23 and C++26 while remaining adaptable to older compilers on request.

Location, current course term

Contact us

Custom Customized Training (date, location, content, duration)

The course:

Hide detail
  • Clear, maintainable code written for people
    1. Use familiar practices and design patterns
    2. Describe software as components and behavior
    3. Separate behavior from implementation details
  • Object-oriented software design
    1. Program composed of collaborating components
    2. Components have assigned responsibilities
    3. Reason about individual components and roles
  • Classic object-oriented programming
    1. Represent components as class instances
    2. Instances define component state and relations
    3. Classes define behavior and component interfaces
  • Inheritance and replacing ancestor methods
    1. Adjust behavior by overriding methods
    2. Template Method design pattern
    3. Static implementation in modern C++ (CRTP)
  • Reuse of code written once
    1. Share general code via inheritance
    2. Compose objects from ready-made building blocks
    3. Generic data types and algorithms
  • Separating interface and concrete implementation
    1. Abstract classes as interface definitions
    2. Swap implementations at runtime (dynamic polymorphism)
    3. Strategy design pattern
  • Dependencies between components in C++
    1. Ownership (RAII), borrowing and references
    2. Pointers, references and polymorphism
    3. Object interactions and method calls
  • Tools of generic programming
    1. Composition using generic templates
    2. Policy-based design pattern
    3. Move variability to compile time
  • Principles of good software design
    1. Component independence and localized changes (SRP)
    2. Depend on interfaces, not implementations (DIP)
    3. Closed for modification, open for extension (OCP)
  • Changing component behavior at runtime
    1. State machine and State design pattern
    2. Modern approach using std::variant
    3. Differences from classic state machines
  • Connecting interfaces with connectors
    1. Separating different domains (Bridge)
    2. Bridging incompatible interfaces (Adapter)
    3. Exposing a simpler interface (Facade)
  • Chaining through a single interface
    1. Add behavior to an existing system (Decorator)
    2. Chain possible handlers (Chain of Responsibility)
    3. Protecting and controlling access (Proxy)
  • Linear data structures and sequences
    1. Traversing data structures (Iterator)
    2. Differences between linked list and chain
    3. Ending without null pointers (Null Object)
  • Composing more complex objects and components
    1. Branching by concrete type (Visitor)
    2. Tree-like object structures (Composite)
    3. Solutions using std::variant and std::visit
  • Creating diverse object types
    1. Factory for creating many kinds of objects
    2. Abstract Factory for families of objects
    3. Use lambdas and std::function for registration
  • Single-instance objects
    1. Create a single instance in modern C++ (Singleton)
    2. Managing global resources
    3. Communicating state with the OS
  • Multi-step object construction
    1. Builder object as an intermediate step
    2. Methods to modify builder and final build
    3. Split builder into multiple phases
  • Signaling and event handling
    1. Central coordinating component (Mediator)
    2. Registering event subscribers (Observer)
    3. Signals with templates and lambdas (signals & slots)
  • Generation, streaming and lazy evaluation
    1. Process sequences and pipelines (iterators, views)
    2. Use message queues for decoupling
    3. Generation using std::generator
  • Representing data changes
    1. Describe a specific change (transaction, command)
    2. Sequence of successive changes (journal)
    3. Use mini-languages or bytecode (interpreter)
  • Storing and restoring state
    1. Create snapshots of state (snapshot, memento)
    2. Manage history of snapshots (history, recovery)
    3. Combine snapshots and transactions (incremental backup)
  • Optimizing data handling
    1. Data structures with instant snapshots (copy-on-write)
    2. Share mostly-immutable parameters (Flyweight)
    3. Cloning objects and the "rule of zero" (prototype)
Assumed knowledge:
Good knowledge of C++ programming.
Recommended previous course:
C++ – Metaprogramming and High-Performance Applications (CPP5)
Recommended subsequent course:
C++ – Threads, Coroutines and Asynchronous I/O (CPP4)
Schedule:
4 days (9:00 AM - 5:00 PM )
Language:

Vybrané zákaznické reference

RETIA, a.s., Radek P.
C++ – Design Patterns and Idioms ( CPP3)
"Zkoumání problematiky návrhových vzorů s panem Šimerdou bylo velice přínosné, zodpověděl nám všechny naše dotazy a uváděl barvité příklady z praxe."
RETIA, a.s., Roman R.
C++ – Design Patterns and Idioms ( CPP3)
"Školení bylo velice dobře připravené. Lektor dokázal zodpovídat i dotazy nad rámec tématu. Nejvíce mě zaujala rozsáhlá znalost programovacích technik/přístupů pro různé programovací jazyky v rámci daného tématu."
Digiteq Automotive s.r.o., Jan M.
C++ – Design Patterns and Idioms ( CPP3)
"Vše naprosto perfektní. Srozumitelný výklad a praktické příklady, velmi cením využití Compiler Exploreru."
Digiteq Automotive s.r.o., Jakub B.
C++ – Design Patterns and Idioms ( CPP3)
"Lektor mel opravdu siroky prehled a dokazal uvadet priklady i z jinych programovacich jazyku. Prijemne zazemi. "
Digiteq Automotive s.r.o., Jiří P.
C++ – Design Patterns and Idioms ( CPP3)
"Naprostá spokojenost"
R-SYS, s.r.o., Michal V.
C++ – Design Patterns and Idioms ( CPP3)
"So školením som bol spokojný a v podstate naplnilo moje očakávania. Dozvedel som sa o pár nových a zaujímavých návrhových vzoroch, ktoré si viem predstaviť aj hneď implementovať. Taktiež som sa naučil aj niektoré C++ vlastnosti/konštrukcie, ktoré som nepoznal."
KBC Global Services Czech Branch, Václav H.
C++ – Design Patterns and Idioms ( CPP3)
"Oceňuji praktické příklady návrhových vzorů, hlavně také to že byly přizpůsobeny C++ a tomu, co ten jazyk umí. To + příklady využití z praxe jsou pro mě největší přinos oproti jiným zdrojům."
Siemens, s.r.o., Lukáš S.
C++ – Design Patterns and Idioms ( CPP3)
"Velmi přínosné školení. Praktické ukázky různých návrhových vzorů, které jistě pomůžou při udržování našeho kódu do budoucna."
ERA a.s., Jakub Š.
C++ – Design Patterns and Idioms ( CPP3)
"Školitel je v dané problematice zjevně erudovaný. Je pohotový a flexibilní (reakce na dotazy atd). Návrhové vzory probrány podrobně a dostatečně na konkrétních příkladech i přeneseny do kódu."
JABLOTRON CONTROLS s.r.o., Stanislav K.
C++ – Design Patterns and Idioms ( CPP3)
"Chválím dobré praktické ukázky kódu, osobní přístup, postřehy z praxe."
Digiteq Automotive s.r.o., Jan Č.
C++ – Design Patterns and Idioms ( CPP3)
"Zatím nejlepší školení na kterém jsem byl. Dávám vše za 1, byl jsem moc spokojen. Děkuji"