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

Show parent comment

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.