4 ms·
I really think OO has been a net loss for the industry and individual programmers. Attaching all functions to data structures, inheritance, hiding fields... t
by herdrick 19y ago
I really think OO has been a net loss for the industry and individual programmers. Attaching all functions to data structures, inheritance, hiding fields... these are a net loss. (And about that field hiding aspect of encapsulation - Who are we hiding them from? I ask you.)
- earthboundkid 19y agoIt makes sense to "hide" stuff when you're writing a library/framework that you might update in the future. It doesn't when you're just writing for your particular project.
- Tichy 19y agoIt's not a security thing, simply a housekeeping thing. It is more readable and understandable if an object only exposes the methods that it's user needs. It's about reducing complexity. I think in Java you actually can access the private methods of an object via Reflection, if you absolutely want to.
- kingkongrevenge 19y ago"It is more readable and understandable if an object only exposes the methods that it's user needs." This sort of encapsulation is not specific to OO. You can hide data and methods within modules without using classes. In C++ terms you use anonymous namespaces. In C, perl, python(?) and other languages a leading underscore or "static" declaration conveys encapsulation, which is good enough as far as I'm concerned.