Hacker News new | ask | show | jobs
by hardboiled 5321 days ago
There is nothing wrong in not liking OO. But OO is an ambiguously defined paradigm and unlike functional programming doesn't really have a definitive calculus. However, Peter Landin did show that untyped OO could be reduced to lambda calculus.

I think there is a difference between OO as it is practiced and interpreted by mainstream languages such as Java, C++ and how it was originally intended to work (a la Smalltalk, Self). Interestingly as someone who got started with Scheme, I found that Javascript actually helped me understand OO and FP in a more integrated way: Functions/closures as these hybrid Objects or vice versa Objects as Functions/closures. Objects were intended to just abstract away the structure of data and state (but I see lots of OO that treats objects like data structures with lots of mutable state) whereas with functions they are coupled to the representation of the data structure, which is fine if there is either a small set of data structures (lists/trees for Lisp/Scheme) or the domain you're modeling has an optimal stable data representation.

Also after looking at Self, I think class based OO is a more difficult starting point into OO. Inheritance is one modeling method of OO but is way over used. And cause me all sorts of frustration when I started OO.

So if you think you don't like OO, you have to really define for yourself what OO to you means. It means a lot of things to different people. For java programmers it means making everything into classes and interfaces, lots of types and hierarchies, no lambdas(yet?). Some assume the difference between FP and OO is mutable state or first-class-functions. But I don't believe so.

It is really an approach to abstraction: does the structure of the data change more than the operations on that data, then OO is better suited there.