Hacker News new | past | comments | ask | show | jobs | submit login

OO doesn't match the way I think anyway. OO makes it appear as if all objects can do something, e.g. window.open(), list.add(item). In the real world some objects are passive, some objects are active and conscious and some complex objects have behaviour but don't respond to simple instructions (e.g the economy).

I believe this is a very fundamental feature of how we think about the world and it's totally unlike OO. But I also think that it doesn't matter at all. Formal systems don't need to resemble language or the way we think about the world (or the way we think we think about the world)

We don't naturally think like Snoopy swearing, but regular expressions are still a very productive tool for someone who has learned to think differently than he would naturally do. The same goes for maths and many other tools.

I'm very skeptical about OO, but that's not because it doesn't match the way I think. I'm skeptical because OO APIs force me to know things I don't want to know. They constantly make me think about which class has a particular function.

But the rationale for putting a function in one class or another is based on implementation considerations that are of no concern to me as a user of an API. It's mostly about which object's state is affected most, how dependencies are managed, what types of changes are expected, and so on.

I've given this example elsewhere but here's the short version again: Say you want to initiate the sale of a property via some API. There are many objects involved: A buyer, a seller, a contract, an estate agent and a property. Which of the five classes involved contains the method you're looking for?

It could be in any of these classes and I don't want to think about it. I want a sell(property, buyer, seller, contract, agent) function and the API should figure out its own state and dependency matters.




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

Search: