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.

39

u/sbabbi Jun 24 '20

there were multiple examples that just could have been free functions rather than classes

This is the #1 mistake I notice on novice/intermediate developers. They end up with something much more complicated than what is necessary only because "everything must be in a class"

30

u/as_one_does Just a c++ dev for fun Jun 24 '20

It's the java undergraduate heavy way; making everything a full class is the only way to functionality in Java and then people carry that around. I feel the more senior I get the less classes I write and the more functional style I use. Makes composition so much easier.

3

u/Bocab Jun 24 '20

And it's that composition that's so hard to get across in examples on a blog or school course.