Hacker News new | ask | show | jobs
by gambler 2435 days ago
This whole comment section tells me that almost no one on HN really understands OOP.

OOP is not about nouns. It's about establishing protocols between subsystems. What you're describing are the typical fake "dilemmas" of someone coming from a static, class-oriented programming languages like Java.

Look up Class Responsibility Collaborator exercise.

3 comments

I looked it up and while worthwhile, I would need someone to explain how it applies to this specific comment section.
> It's about establishing protocols between subsystems.

Is that what it's about? I try to establish protocols between subsystems without OOP quite often. Are you referring to message passing specifically?

> Is that what it's about?

I'm pretty sure most people who strongly like OOP are sure their particular definition is the correct one. I haven't seen many people agree about what that definition is though. I generally dislike OOP, but perhaps that's because my definition is "encourages implementation inheritance". As you're keen to note, the standard list of other things (encapsulation, message passing, dynamic dispatch, interface inheritance, and even "establishing protocols") are available in a lot of other languages which people don't generally consider OO.

Perhaps I'm ignorant, but I like my way of doing things, and a.f() is less attractive to me than f(a) for all the reasons I listed.

> This whole comment section tells me that almost no one on HN really understands OOP.

Or maybe it tells you that the benefits of OOP are different from what they're theoretically supposed to be. What I read from the thread is that there seems to be significant psychological appeal to some in the noun-verb way, and OOP (perhaps unintentionally) satisifies that need. (And that helps me understand the frequent "Julia needs a thing.do() syntax" complaint on the Julia forums, and why telling them "semantically do(thing) does the same thing" doesn't seem to work.)