3 ms·
It isn't. Not in a significant way at least. I think the main benefit of OOP isn't really abstraction, like modules, because even function signatures coupled t
by undreren 8y ago
It isn't. Not in a significant way at least.
I think the main benefit of OOP isn't really abstraction, like modules, because even function signatures coupled to a struct definition can be a great abstraction. Abstraction is about generalizing something in order to hide its inner workings. Modules can do that just fine.
What OOP "got right" was to make it easy to use indirection to pass function pointers. That way, you can easily create pluggable systems at runtime, so that strategies can be dynamically chosen. Passing function pointers in c can be pretty tedious, if you need to send implicit state with it.
I've started to get really annoyed with indirection though. It's getting abused so thoroughly in order to make bad designs testable through dependency injection. I find that it is much easier to use dependency rejection instead.
- scarface74 8y agoWhat OOP "got right" was to make it easy to use indirection to pass function pointers. There was the part in my original post... ....and had structs with function pointers that did different things based on how the struct was initialized.