Hello all,

I’m late on this report. I’ve been traveling a lot in the past week and did not have a chance to sit down and write this report.

The meeting info on meetup can be found here. Took place on Tuesday, January 14, 2025.

Recording is uploaded as usual to our sdcppmu Youtube channel:

Topics discussed during the meetup:

In this meeting, we’ve discussed the Decorator pattern.

This is heavily inspired by Klaus’ excellent book (which I consider is the bible of Modern C++ Design Patterns). The book can be found on Amazon/O’reilly as printed or soft copy. If you do not own a copy, run, don’t walk to grab one and read!

More things discussed… :

Packtpub publication announced 2 new C++ books which we mentioned (and had coupons to share):

Next, Rich Yonts, the author of a manning’s title 100 C++ Mistakes and How to Avoid Them, called for volunteers to participate in a study. Please contact Rich for more information (hopefully this is still applicable when you read this).

Quiz time – We looked at cppquiz-352 which demonstrates how typedef is not a … new type!

I went through the previous meetup content to clarify few things related to mapping runtime values to compile time, in order to be used as NTTP like in func<val>(). BTW – it’s really cool and you should probably check it out. Lots of fun!

The main talk was about “C++ Decorator Design Pattern”. This is an important and very useful Pattern. Few highlights:

  1. We looked at C++ decorator vs Python function decorator. Not related to each other, comparison was just for fun 🙂
  2. Gang Of Four Decorator Pattern – Structural design pattern used to dynamically add behavior to objects.
  3. Supports OCP and SRP! this is a huge bonus!
  4. We looked at specific use case of adding Decorator.
  5. Decorators can be thought of compositions of features/behavior. Think f(g(h(x))).
  6. C++17 STL allocators also implement such mechanism!

And of course, we always need to highlight shortcoming of this pattern:

  1. Every level in the hierarchy is another level of indirection. Perfs might be impacted but MEASURE!
  2. You could make silly mistakes like applying decorator twice.

That’s it for reading!

Kobi

Leave a Reply