3 ms·
I've encountered this code a lot in C, and every time I thought that this style of > stuff_do_something(stuff, some_parameter) _is_ OOP and identical to > st
by golergka 11y ago
I've encountered this code a lot in C, and every time I thought that this style of
> stuff_do_something(stuff, some_parameter)
_is_ OOP and identical to
> stuff.do_something(some_parameter)
, although in language without support for OOP (of course, you can hack OOP on top of C with preprocessors and stuff, but let's pretend we forgot about that embarrassing abominations). And every time I saw that I wished that I could type the second one instead, just because of how more natural it feels.
- mercer 11y agoI like the latter too, but where 'stuff' is a namespace rather than an object in the traditional sense.
- V-2 11y agoThe missing link is extension methods/functions, which are sort of syntax sugar for the former (letting it pretend to be the latter)
- AndrewDucker 11y agoExactly. OOP is: a) A code naming/organisational issue b) Some formalisation of structure, so that developers can specify what is/isn't allowed in their code. Both of thise have advantages and disadvantages, and the structure can be over-formalised and made too complex. But this doesn't make OOP bad. It makes bad design bad.
- jdminhbg 11y agoWell yes, when you redefine "OOP" to mean "well-organized code," then all well-organized code is object-oriented. That's not what people mean when they refer to OOP though -- they're talking about data+behavior encapsulation, inheritance, message-passing, etc.
- marcosdumay 11y agoOOP is not "well-organized code". It is a specific kind of code organization that derives a good part of its value from being universal.