r/cpp • • Mar 14 '26

Discussion of Code Structure and Code Complexity Implications of Basic C++ Language Features

After 10 years of programming professionally in C++, I came to realize that I generally prefer a simpler subset of the language for my day-to-day work, which mainly involves desktop application development.

Working in a 30 year old code base for so long, you get to see which design decisions panned out and which didn't. This lead me to think about the technical reasons for why certain C++ language features exist, and what long-term impact they have in terms of code complexity and code structure. The result is a somewhat lengthy and very subjective article that I would like to share.

You can find the article here:

https://slashbinbash.de/cppbas.html

The premise of this article is: if you use simple language tools you can concentrate on solving the real problems at hand, rather than solving language problems. This is very much inspired by listening to interviews with Casey Muratori, Jonathan Blow, Bill "gingerBill" Hall, and others.

I discuss several aspects of the C++ language like functions, structures, statements, enumerations, unions, arrays, slices, namespaces, classes, and templates. But I also go into topics like error handling, and ownership and lifetime. I finish the article with a chapter about code structure and the trade-offs between different approaches.

The goal of this article is to give the reader a sense of what code complexity and code structure means. The reader should be able to base their decisions on the technical aspects of the language, rather than the conceptual or philosophical reasons for why certain language features exist.

I'd be thankful for any feedback, corrections, and ideas that you have!

Note: I still need to clean up the article a little bit, and add a few paragraphs here and there.

24 Upvotes

31 comments sorted by

View all comments

Show parent comment

5

u/UnicycleBloke Mar 15 '26

I first encountered him making an incoherent ramble about the evils of virtual functions and the assertion that if you used them, you would be fired. When they're useful, they're useful, and vastly superior to any alternative I've seen in C. I don't know to what extent his blathering is performative for his channel, but I'm unimpressed. All I see is a loud, excitable, and overly opinionated American who loves the sound of his own voice. It's virtually unwatchable to my British sensibilities. I do not value the advice of such people in any context.

I never really know what people mean by "OOP" but I do regard the excessive use of abstract bases and inheritance hierarchies, which was so common in the 1990s, as problematic. If that's what Casey is really complaining about, I guess we agree.

3

u/Plazmatic Mar 15 '26 edited Mar 16 '26

I never really know what people mean by "OOP" but I do regard the excessive use of abstract bases and inheritance hierarchies, which was so common in the 1990s, as problematic. If that's what Casey is really complaining about, I guess we agree.

This is the talk I was talking about, warning it's long: https://youtu.be/wo84LFzx5nI. But it's also very possible he's changed his mindset overtime rather than this always being his position.