Live data from Hacker News

Moving Beyond the OOP Obsession

prog21.dadgum.com

71–72 of 72 posts

Re: Moving Beyond the OOP Obsession

#71
post #6

What baffles me about OOP is that massive aspects of how to use it have changed, and that change happened after it gained popularity as a good technique. How could it have become popular when people were doing it wrong? The article mentions inheritance, but there's also heavy vs light classes. When I was taught OOP, an object knew how to do all the things to itself. It could draw itself on the screen, modify itself,…

Perhaps the question isn't binary, but rather have a whole range of answers. Heavy classes was probably better than the procedural code that came before it, but light classes end up more easy to reason about in the long run. I know for a fact that I have made that progression as I gained experience.

Re: Moving Beyond the OOP Obsession

#72
post #55

Earlier quoted context omitted.

> when people are talking about OO objects they mean data+behaviour The distinction between behavior being "a set of methods defined inside a class", and "a set of methods whose first param is a particular type of struct" is not that important.

The distinction between "a set of methods with privileged access to encapsulated internal state of a class" and "a set of functions whose first param is a particular type of struct, and operate on members of that struct that everyone can access" is pretty critical though.

Definitely, and encapsulation is one of the good things you get out of well designed OO. But I don't think it's that relevant in regards to objects as data+behavior, and while it leads to much better designs, I don't think it's required—hence all of the C libraries written in a very OO style. So: yes, but not really relevant to the point being discussed.
Post reply on HN