3 ms·
I think there's a fundamental misconception at the heart of how people think about OOP, and it revolves around "what is an object". In all likelihood OOP perhap
by ricksplat 11y ago
I think there's a fundamental misconception at the heart of how people think about OOP, and it revolves around "what is an object". In all likelihood OOP perhaps became hyped because it seemed to provide a paradigm whereby one could develop programs as simulations that resembled the real-world systems they were modelling. This is somewhat similar to the way COBOL took off because it was intended to facilitate verbose readable code that would be verifiable by analysts.
I think this may have been the original intention of real OOP languages (OO theory itself developed as a way of modelling knowledge from human perspective [1]) such as Smalltalk but as the author says it just isn't feasible to do this "all the way down". In my experience OOP of this style is best used as a high level abstraction but beneath that for the sake of pragmatism and performance you usual need to get a bit more imperative.
The other perspective on OOP is that one models your solution space rather than your problem domain. One models data such as `CarHoodDrawingAlgorithm` rather than `CarHood` - and it's this reasoning that can lead us towards functional programming, which may be described as "OO for functions".
OO is still useful, because objects are something we naturally understand and can discuss. "Oh I got an exception when I called 'draw' on CarHoodDrawingAlgorithm / Oh really, that's a subclass of CanvasDrawer which I wouldn't have expected to throw that type of exception"
I think it breaks down where you have a mismatch between what different parties understand what an object to be, and how pervasive the paradigm needs to be. Quite rightly advanced programming topics are moving towards FP which more specifically answers the concerns in the solution space, which isn't I believe what OO was meant for.
[1] https://en.wikibooks.org/wiki/Cognitive_Psychology_and_Cognitive_Neuroscience/Knowledge_Representation_and_Hemispheric_Specialisation#Hierarchical_Organisation_of_Categories https://en.wikibooks.org/wiki/Cognitive_Psychology_and_Cogni...