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.

THIS TRAINING COURSE WILL HELP YOU:

  • Review common design patterns and try selected ones in C++
  • Explore C++-specific techniques, patterns and idioms
  • Learn when each pattern makes sense in real projects
  • Recognize and avoid overuse of patterns and overengineering

WHO SHOULD ATTEND?

  • Developers actively working on software projects and products
  • Programmers working on all types of software, including embedded
  • People interested in software design and design patterns
  • Developers preparing for software testing

COURSE LOCATION AND AVAILABLE DATES



Public courses are usually delivered in Czech, but this course is also available in English. We can arrange private training for your team online, at your premises or in our classrooms, and tailor the content to your needs.

For groups of around 4 or more participants, private training can already be comparable in price to booking individual places on a public course. Send us your requirements and we’ll recommend the best format and provide an exact quote.

Request training in English

Course content:

Hide details
  • 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)
Prerequisites:
Good knowledge of C++ programming.
Recommended previous course:
C++ – Metaprogramming and High-Performance Applications (CPP5)
Recommended follow-up course:
C++ – Threads, Coroutines and Asynchronous I/O (CPP4)
Schedule:
4 days (9:00-17:00)

Training and learning environment