Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My definition of OO is roughly the one given here: http://www.info.ucl.ac.be/~pvr/paradigms.html Meaning, doing OO is basically using closures and mutable state (let's say objects are a form of closure). I don't like mutable state, therefore I don't like OO as defined above.

We can also define OO as the use of inheritance. The problem with inheritance is that it spurs the violation of decoupling. More often than not, derived classes are tightly coupled to their base class. I don't like that. This paper also suggest that inheritance is not very good, because it would increase the error rate by 6: http://www.leshatton.org/Documents/OO_IS698.pdf (Note that I don't take this paper as a proof that OO is bad in general. Rather, it strongly suggest that C++ without templates nor the STL, used in an OO fashion, is worse than plain C).

Now, if you forbid (or severely limit) both mutable state and inheritance, I really don't see what is left to OO. We could see you `Animal` data type and the Ocaml module system as forms of OO, but at this point, "OO" would mean anything (and therefore be meaningless).

(Note: when I say "I don't like X", I mean I will avoid X as long as the resulting solution isn't demonstrably simpler.)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: