San Diego C++ Meetup #73 – RAII – How hard could it be?

Hello everyone!

Here is the summary of the last session, took place on Tuesday, April 15 2025.

The session had few topics discussed.

First, I’d like to announce that we have a new Sponsor to our meetup!

Jetbrains has generously agreed to sponsor the yearly Meetup fees!

It is super fun to have your favorite editor being the one sponsor it. Such a win win for me 🙂

Thank you Maria and the team from Jetbrains helping me on that!

Meetup page can be found here

The recording can be found here:

Discussion points in the meetup:

  1. What am I snacking – I talked a bit on Patrice Roy‘s new book “C++ Memory Management” which is an excellent book! Grab it!
  2. AI Assistant and vibe coding. Gave some insights from my experience working on multiple tools, evaluating multiple plugins to IDEs. And it’s fantastic. I’m so scared! The future is here and things IMO will only get better. Senior engineers will have super powers, Junior engineers would need to make sense of what is given to them and I’m afraid that w/o enough experience, this is a challenging part.
  3. Quiz How much impact RTTI (class types w/ or w/o virtual functions) has on typeid?
  4. RAII. Here is what we covered:
    • Simple RAII class
      • I realized after the meeting that I missed having =delete for the copy ctor so we do not mess up copying the handle and risking in double cleanup of the same handle.
      • Better to = delete your copy/op= so you are on the safe side.
    • Using simple SFINAE
    • Using simple concepts
    • Using static_assert
    • Why different instantiation of the RAII class fails.
      • Function pointers
      • References to functions
      • add_pointer_t
      • decltype(auto), return (x), decltype((x))
      • What did Scott Meyers had to say in his last book (Effective Modern C++: C++11/14)
      • Using https://cppinsights.io/ to decipher templates.
    • Using unique_ptr<> with custom deleter.
    • Using gsl::finally
    • Capture-less lambdas in un-evaluated context.

Patrice Roy’s book:

Thank you for reading!
Kobi

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