(no title)
x0hm | 5 years ago
One of the biggest issues with OOP I think is the lack of a unified understanding. I think there's value in trying to define a "right" way, if only so that when we are talking about OOP, we are talking about the same thing.
I think that definition would require a volume of text, so I'm not prepared to fully elaborate, but ultimately I think that the core issues lie in our approach. We tend to think like computers when programming, which leads to OOP being a morass of procedural code masquerading as objects. Effectively, we tend toward functional decomposition. Code is boxed up into related data and behavior, and we call these "objects". What we really should be doing is approaching object design as a function of behavioral affordances.
Object design then becomes a necessary, often overlooked, step.
Object design is the first hurdle. The second is in the actual implementation, wherein we traditionally treat our objects as "data" and "behavior upon that data". I can't tell you how many times I've cringed at seeing "Thing" and "ThingManager" in code.
OOP might not be a good thing. It definitely isn't a good thing when it is done poorly. Exposing an object's data, for instance, makes the entire paradigm worthless. The widespread acceptance of `public` data members completely ruins the usefulness of OOP.
That brings up implementation languages. Programming languages really want you to use them, and they make it easy to eschew good OOP principles in favor of ease of use. Accessibility features and syntactic sugar lead not only lead us away from the paradigm, but also confuse about what it actually is.
OOP's biggest strength, and one that most of the literature doesn't go into, is it's ability to lighten cognitive load. When an object works independently of its environment, it is easy to both learn and understand that object. But we sacrifice a huge chunk of this strength in the name of "getting the work done".
I believe that good OOP resembles FP in implementation. Not completely, but much more closely than the procedural landmines we're used to would have us believe. OOP just provides a lower barrier to entry in that it lends itself well to the usage of basic programming constructs and it more closely resembles how humans think, though that could also be argued.
No comments yet.