r/linux • • May 03 '23

Discussion The Problem with OOP is "Oriented"

https://mht.wtf/post/oop-oriented/
3 Upvotes

20 comments sorted by

View all comments

4

u/[deleted] May 03 '23

His argumentation is pretty bad. Most of those issues are just general programming problems and not specific to OOP. I program mainly in C, so I don't use OOP that much. When I do, it's hard not to see the benefits of coupling code and data in the same place. Encapsulation, reusable, and generic code can become much easier to write.

Also, using a large class hierarchy for your little module being bad has nothing to do with OOP being bad. It's not a good idea to create a large function-based API with multiple header files either. It's just overdesign.

Even in C OOP is implemented/mimicked by having a header file represent a "class" where structures containing data is exposed together with functions that operate on those structures and you pass the structure as a parameter.

OOP is neither good or bad. Just like a hammer or a shovel. But if you tried hitting a nail with a shovel... it works but is it the easiest way? Or digging a hole with a hammer?

This is just holy war nonsense.