San Diego C++ Meetup #72 – Refactoring with C++

Hello everyone!

Tuesday March 18 2025 evening was all about Refactoring with C++ by Dmitry Danilov.

But before we dive to the summary – we’ll mention that there was a Job posting presented by Parker Lanning – Looking for Mid Sr. C++ Developer Role – contract role. Please feel free to contact Parker.

We also mentioned the following:

You can find the recording here:

Link to the meetup page.

I’ll start by saying that I really like Refactoring business, and especially in C++. A clear evidence that there is indeed something wrong with me. (Un?)Fortunately, Refactoring is part of our life. Code evolves, rotten and not maintained correctly. There is some joy in taking such code and making it better, more readable, modern, more maintainable and sometimes even faster!

The book is good. It has a lot of good information in Design choices, reasons for tech debt, how to avoid it, SOLID and more! Grab the book!

So what did we discuss?

  • First, checkout the variety of books available on this subject.
  • Checkout Refactoring.Guru – great site! also has the Design Patterns aspect.
  • We discussed clean code, technical debts, why this is happening, what happens with personal taste? How about the gaps in ones knowledge of the language, the libraries, good practices?
  • People who don’t know about the tool, have questions and concerns. How would I know that std::accumulate is actually doing the right thing and not shooting a rocket to the moon (well, as part of the accumulate operation?)
  • What is a boring but effective API? How about consistent API, const-correct API?
  • What is SOLID? Why it’s so important and not just a buzzword or a Software marketing term. (It’s not just marketing term, it’s super important foundation!). Also think about KISS!
  • How about C++ Core Guidelines ? Yes, these are good and important to know!
  • We discussesed Strategy Pattern, Dependency Injection, Interface Segregation and of course, I mentioned the C++ Design pattern bible of the modern days: C++ Software Design: Design Principles and Patterns for High-Quality Software, by Klaus Iglberger
  • We closed with some low hanging fruits for refactoring Legacy code.

There is no universe where we can cover everything in < 1hr. So please take a look at the book and other useful resources. Do it for yourself, future self and your team.

Oh yes – AI might save us and write better, more idiomatic code for us. I want to believe this would happen soon (well you could argue that it is already happening).

Thanks for reading,

Kobi

Debunking C++ Myths: Dispelling Misconceptions and Embracing Modern C++

San Diego C++ Meetup, February 14th 2025. yes, Valentine day, because we love C++ 🙂

Link to the meetup page here.

Recording uploaded to San Diego C++ Meetup (sdcppmu) YouTube channel:

Hello everyone!

February 2025 was dedicated to a new book from Packpub publication: “Debunking C++ Myths: Dispelling Misconceptions and Embracing Modern C++” by Alex Bolbaoca and Ferenc Deak.

Amazon link here.

During the meeting Alex and Ferenc shared their career stories, how they were introduced to C++, what other languages have influenced their work and answered various questions on the book., and their favorite chapters in the book.

Tune into the the recording to learn more about Alex, Ferenc and bunch of details from the book itself.

Enjoy the recording!

Kobi

San Diego C++ Meetup #70 – Decorator Pattern

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