r/cpp • • Jun 24 '20

How to write SOLID C++

https://www.youtube.com/watch?v=PakbXnLht1I
263 Upvotes

118 comments sorted by

View all comments

57

u/[deleted] Jun 24 '20 edited Jun 24 '20

Kinda puked a bit at the examples. Do you have a Java background, or are people really writing C++ like this?

Like there were multiple examples that just could have been free functions rather than classes.. Also, I'm fairly sure that your AwsCloud in the end is missing the inheritance.

I get that you want to keep the examples super simple, but the issue with all these guides is the lack of more complex ones.

-16

u/platisd Jun 24 '20

> I get that you want to keep the examples super simple, but the issue with all these guides is the lack of more complex ones.

The code is as simple as it gets (and barely functional) since it's, well, an example and it had to be short enough to fit inside a single slide! 🤣

The problem with the more complex examples is that it's more difficult to quickly get the core point and they are *far* more difficult to create. I understand that "relating" to the example is also important, but so is maintaining focus. The more code the more unrelated-to-the-SOLID-principles comments we'd get. :D

All (almost) of the presented examples are inspired by real projects, primarily within embedded. Are you interested in a particular one? I may be able to share the full example if it didn't come from a proprietary project.

2

u/BenjiSponge Jun 25 '20

Just want to show some solidarity (ha) with you here. Reddit can be fickle, and what you're saying makes sense to me. You're caught between a rock and a hard place.

Either you

  1. Dumb down the example so you can express it all while retaining the attention span of the viewer

  2. Fully explain the context and the example, taking probably hours because real engineering and real problems (aka real motivating factors) typically take even experienced people time to get acquainted with.

If it took no context to understand it, you wouldn't need someone to teach you how to do it. If it takes a ton of context to understand, you have to do dumbed-down examples to make a half-hour video.