It occurred to me in the past week that there's a relationship between object-oriented programming and the psychological concept of real-world object affordances.
In our robotics research, we've mention Gibson's focus on how an affordance is not just about the object but about the agent (person) and the object. I can't grasp a basketball with one hand, for instance, but someone else can.
This reminds me of the topic of minimal interfaces on OOP and issues like mixins vs. extension methods. You can't possibly put everything you want about an object into its class (even with mixins). But how common are certain contexts (agents)? Only the most common things (if that can be determined) should be inside the class. That's my opinion. And the language should make other extensions as easily available as possible, now depending on your real context.
Multimethods also fit into this topic.
No comments:
Post a Comment