///
Based on my last poll, “Which mentoring program should I implement next?” I recognized that there is a significant demand for writing about “Design Patterns and Architectural Patterns with C++”. Today, I would like to present to you my plan for future posts.
Although I call this introduction post “Design Patterns and Architectural Patterns with C++”, the focus of this article series is way broader. I also write about basic terminology, idioms, and concurrency patterns. The image serves two purposes.
Be part of my mentoring programs:
These are only the main parts of the terminology I will write about. I also will write about additional aspects of patterns, such as their advantages and disadvantages, history, and structure.
Okay, both classics GOF (1994) and POSA (1996) are a bit dated. What does this mean for modern C++? This is precisely the question I tackle in the next series of posts.
![patterns](https://www.modernescpp.com/wp-content/uploads/2022/06/patterns.png)
- It gives you the first idea of my plan. This means you know what you can expect.
- You may miss one of your topics in my overview. Consequentially, write me an e-mail or, even better, write a guest post.
Terminology
Design Pattern
The term design patterns go back to Christoph Alexander, who wrote about architecture and urban planning: “Each pattern is a three part rule, which expresses a relation between a certain context, a problem, and a solution.” The classic “Design Patterns: Elements of Reusable Object-Oriented Software” by Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides (short GOF) coined this term for software development. Roughly said, there are three types of patterns: architectural patterns, design patterns, and idioms.Types of Patterns
Architectural patterns describe the fundamental structure of a software system and are often based on design patterns. An idiom is an implementation of an architecture or design pattern in a concrete programming language. This classification of patterns goes back to the second classic that is also a must-read: Pattern-Oriented Software Architecture: A System of Patterns” Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal (short POSA).Anti-Patterns
We have Patterns and Anti-Patterns. Anti-Patterns are a proven way to shoot yourself into the foot.
Modernes C++ Mentoring
Be part of my mentoring programs:
- "Fundamentals for C++ Professionals" (open)
- "Design Patterns and Architectural Patterns with C++" (open)
- "C++20: Get the Details" (open)
- "Concurrency with Modern C++" (starts March 2024)
Design Patterns
I make it short. The seminal book “Design Patterns: Elements of Reusable Object-Oriented Software” has 23 patterns. They are classified in two ways:- Creational, structural, and behavioral
- Class patterns and object patterns
![15DesignPattern](https://www.modernescpp.com/wp-content/uploads/2022/06/15DesignPattern.jpg)
Idioms
An idiom is an implementation of an architecture or design pattern in a concrete programming language. We have many idioms in C++ such as- Copy-and-swap
- The rule of zero, fix, or six
- Hidden friends
- Resource acquisition is initialization (RAII)
- Dynamic polymorphism and static polymorphism
- Templates (curiously recurring template pattern (CRTP), expression templates, policy and traits, tag dispatching, type erasure, … )
Architectural Patterns
Architectural patterns describe the fundamental structure of a software system and are often based on design patterns. I will present at least the following ones.- Pipes-and-Filters: Decomposes a complex task into a series of elementary tasks that can be composed
- Layers: Split the software system into layers, where each layer has a certain responsibility and provides a service to a higher layer.
- Model View Controller (MVC): Decompose a (user) interface into the three components model, view, and controller
- Model: the core of the application that registers views and controls; updates the view and the controller
- View: Presents the information to the user; get the data from the model
- Controller: Interacts with the user and updates the data
- Reactor: An event-driven application that can accept multiple client requests simultaneously and distribute them to different service providers.
Concurrency Patterns
A necessary requirement for a data race is a shared mutable state. Consequentially, the synchronization patterns deal with both issues. Here are the synchronization patterns I want to write about:- Sharing
- Copied value: Copied data cannot be a victim of a data race.
- Thread-specific storage: Enables global state within a thread.
- Futures: Non-modifiable placeholder for a value set by a promise.
- Mutation
- Scoped locking: RAII applied to locking.
- Strategized locking: Use different locking strategies.
- Thread-safe interface: Extends the critical section to an object.
- Guarded suspension: Combine a lock to be acquired and a precondition to be satisfied before an operation can be executed.
- Active object: Separates the method execution from the method call.
- Monitor object: Synchronizes access to an object so that only one member function can be executed at any moment in time.
What’s next?
In my next post, I start my journey through the “Design Patterns and Architectural Patterns with C++”. First, I will write about design patterns’ origins and history.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, Slavko Radman, and David Poole.
My special thanks to Embarcadero | ![]() |
My special thanks to PVS-Studio | ![]() |
My special thanks to Tipi.build | ![]() |
My special thanks to Take Up Code | ![]() |
My special thanks to SHAVEDYAKS | ![]() |
Seminars
I’m happy to give online seminars or face-to-face seminars worldwide. Please call me if you have any questions.Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.- C++ – The Core Language
- C++ – The Standard Library
- C++ – Compact
- C++11 and C++14
- Concurrency with Modern C++
- Design Pattern and Architectural Pattern with C++
- Embedded Programming with Modern C++
- Generic Programming (Templates) with C++
- Clean Code with Modern C++
- C++20
Online Seminars (German)
- Embedded Programmierung mit modernem C++ (2. Jul 2024 bis 4. Jul 2024)
Contact Me
- Mobil: +49 176 5506 5086
- Mail: schulung@ModernesCpp.de
- German Seminar Page: www.ModernesCpp.de
- Mentoring Page: www.ModernesCpp.org