C++
developers, architects
3-4 days
lecture
workshop

GoF (Gang of Four) Design Patterns is one of the most popular subjects for programming classes out there. Even though the original book provided coding examples written in C++ and Smalltalk, those patterns are most useful in pure OO programming languages (like Java or C#).

This training provides an alternative approach to this subject. First, it discusses the art of a good overload set and class design in detail. In this part of the training, we learn that less is better, how non-member functions influence class encapsulation, what const keyword have in common with multithreading, and many other essential design principles. When we know how to form a well-behaved class properly, we learn a long list of C++-specific idioms that are useful in everyday jobs and are not included in the GoF book. After that, the training thoroughly covers the subjects of inheritance, polymorphism, and value semantics. Ultimately, it describes all of the GoF design patterns, presents their intended use cases and implementation, and confronts that with Modern C++ criticism and possible alternatives. Training includes examples of correct and incorrect implementation of the most popular patterns. As part of the practical exercises, participants have the opportunity to learn about the benefits and the consequences of using each of the approaches.

The training targets C++ developers and code architects who want to improve their skills in designing interfaces and proper class interaction.

This course builds on top of the knowledge delivered in Modern C++ Design: Part I - Stable and Secure Code training, so please consider requesting them in this order.

TRAINING HIGHLIGHTS

  • Emphasis on understanding different use cases of inheritance in C++ language and learning how to reuse this knowledge in own code
  • Understanding the differences between inheritance and polymorphism
  • Learning of different C++ idioms and patterns and their use cases
  • Particular focus on the usage of "C++ templates" in practical tasks
  • Development of error-unfriendly code

TRAINING AGENDA

The following plan is an initial proposal for the training material. The final agenda is always created based on the individual pre-training analysis of the client's requirements and constraints.

  1. Advanced Modern C++ in a nutshell
    1. C++ Types
    2. Value Categories
    3. Name Lookup
    4. Customization points
    5. Range-based for loop
    6. Special Member Functions
    7. Move Semantics
    8. Exception Safety
    9. C++ template definition
    10. Template parameters
    11. Template argument deduction
    12. Template specialization
  2. Stable and Secure Code in a nutshell
    1. Interface and contract
    2. C++ exceptions
    3. Pointless Pointers
    4. C++ Concepts
    5. [[nodiscard]]
  3. Modern API design guidelines
    1. Functions
    2. Overload sets
    3. Type Properties
    4. Classes
    5. Namespaces and Translation Units
  4. Modern C++ Idioms
    1. Immovable
    2. RAII
    3. Copy-and-swap
    4. Smart Pointer
    5. type_identity
    6. Type Traits
    7. Tag dispatch
    8. Policy-based design
    9. EBO
    10. Type Erasure
    11. SOO
    12. Copy-on-write
    13. CRTP
    14. Barton-Nackman Trick
    15. Customization point object (Niebloid)
    16. Passkey
    17. Attorney-Client
    18. Mixin
    19. Singleton
  5. Inheritance vs Polymorphism
    1. Public inheritance
    2. Name hiding
    3. Virtual functions
    4. Pure virtual functions and abstract classes
    5. Interfaces
    6. Virtual Constructor Idiom
    7. Polymorphism and its types
    8. Double dispatch
    9. Private and protected inheritance
    10. Multiple inheritance
    11. RTTI
    12. Value vs Reference Semantics
    13. Concept-based Polymorphism
  6. SOLID Principles
    1. Single-Responsibility Principle
    2. Open-Closed Principle
    3. Liskov Substitution Principle
    4. Interface Segregation Principle
    5. Dependency Inversion Principle
    6. Good vs bad sides
  7. GoF Design Patterns
    1. Criticism
    2. Creational Design Patterns
    3. Structural Design Patterns
    4. Behavioral Design Patterns
    5. Weak-points of "traditional" implementation
    6. Modern C++ ways to do it
C++
developers, architects
3-4 days
lecture
workshop

Trainer

Mateusz Pusz
FOUNDER / C++ TRAINER
Active Voting WG21 Member and Contributor to the C++ Standard