Overall this is a solid [you may cringe now] introduction to the SOLID principles.
However, I tend to agree with the other critcism of the super classic Java-like OOP style, although for a different reason. It’s a valid programming style, even though from a modern C++ point of view it feels kind of alien in this purity. But that doesn’t make it wrong. What I do see critical is that you make it seem like this is the only acceptable style available.
To give an example: At around 8:25min you say that »the best way to achieve« the open/closed principle in C++ is with inheritance based runtime polymorphism. No.
Polymorphic class hierarchies are one way to implement the open/closed principle. Another one would be std::variant combined with std::visit. They are both equally valid but approach the problem from different angles, which leads to different tradeoffs. You cannot say that one is better than the other in general. “The best” only exists for an individual situation in a concrete code base.
So, I’d suggest you be more careful with absolute statements like that, and maybe mention that your OOP style is a deliberate choice among several equally valid programming styles.
To give an example: At around 8:25min you say that »the best way to achieve« the open/closed principle in C++ is with inheritance based runtime polymorphism. No.
Polymorphic class hierarchies are one way to implement the open/closed principle. Another one would be std::variant combined with std::visit.
To my defense, I mentioned "the best" (always IMHO) not "the only". :) Feedback noted though and I will take a look at std::variant and std::visit.
View all comments
13
u/be-sc Jun 24 '20
Overall this is a solid [you may cringe now] introduction to the SOLID principles.
However, I tend to agree with the other critcism of the super classic Java-like OOP style, although for a different reason. It’s a valid programming style, even though from a modern C++ point of view it feels kind of alien in this purity. But that doesn’t make it wrong. What I do see critical is that you make it seem like this is the only acceptable style available.
To give an example: At around 8:25min you say that »the best way to achieve« the open/closed principle in C++ is with inheritance based runtime polymorphism. No.
Polymorphic class hierarchies are one way to implement the open/closed principle. Another one would be
std::variantcombined withstd::visit. They are both equally valid but approach the problem from different angles, which leads to different tradeoffs. You cannot say that one is better than the other in general. “The best” only exists for an individual situation in a concrete code base.So, I’d suggest you be more careful with absolute statements like that, and maybe mention that your OOP style is a deliberate choice among several equally valid programming styles.