GoF (Gang of Four) Design Patterns is one of the most popular subjects for programming trainings 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 good overload set and class design in detail. In this part of the training, among others, 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 very useful in the every-day job and which are not included in the GoF book. After that, the training thoroughly covers the subjects of inheritance, polymorphism, and value semantics. In the end, 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 the examples of correct and incorrect implementation of the most popular patterns, and as part of the practical exercises, participants have the opportunity to learn about benefits and the consequences of using each of the approaches.
The training targets C++ developers and code architects that want to improve their skills in designing interfaces and proper classes 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.
- Advanced Modern C++ in a nutshell
- C++ Types
- Value Categories
- Name Lookup
- Customization points
- Range-based for loop
- Special Member Functions
- Move Semantics
- Exception Safety
- C++ template definition
- Template parameters
- Template argument deduction
- Template specialization
- Stable and Secure Code in a nutshell
- Interface and contract
- C++ exceptions
- Pointless Pointers
- C++ Concepts
- [[nodiscard]]
- Modern API design guidelines
- Functions
- Overload sets
- Type Properties
- Classes
- Namespaces and Translation Units
- Modern C++ Idioms
- Immovable
- RAII
- Copy-and-swap
- Smart Pointer
- type_identity
- Type Traits
- Tag dispatch
- Policy-based design
- EBO
- Type Erasure
- SOO
- Copy-on-write
- CRTP
- Barton-Nackman Trick
- Customization point object (Niebloid)
- Passkey
- Attorney-Client
- Mixin
- Singleton
- Inheritance vs Polymorphism
- Public inheritance
- Name hiding
- Virtual functions
- Pure virtual functions and abstract classes
- Interfaces
- Virtual Constructor Idiom
- Polymorphism and its types
- Double dispatch
- Private and protected inheritance
- Multiple inheritance
- RTTI
- Value vs Reference Semantics
- Concept-based Polymorphism
- SOLID Principles
- Single-Responsibility Principle
- Open-Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
- Good vs bad sides
- GoF Design Patterns
- Criticism
- Creational Design Patterns
- Structural Design Patterns
- Behavioral Design Patterns
- Weak-points of "traditional" implementation
- Modern C++ ways to do it