HOW INTUITIVE IS OBJECT-ORIENTED DESIGN?
Intro:
Object oriented programming was created to make us able to deal the increasing complexity of software systems in way intuitive to the way the mind thinks about the world in terms of objects. But, research shows that OOP is actually quite difficult to learn and practice
Summary:
People consistently make mistakes on simple everyday tasks, even when they have the knowledge and ability to perform the task because of the insuppressible influence of intuitive thinking. Most people when given this scenario
A baseball bat and ball cost together one dollar and
10 cents. The bat costs one dollar more than the ball.
How much does the ball cost?
give the wrong answer. The initial tendency is to say 10 cents. because $1.10 seperates easily into 1 and 10 cents. One current influential model (Dual-
Process Theory) of this is that our cognition and behavior operate in parallel in two quite different modes, System 1(S1, intuition) and System 2 (S2, analytical thinking. S2 monitors automatic responses from S1 and have the power to override these responses when necessary, although in some cases S1 produces quick automatic non-normative responses, while S2 may or
may not intervene in its role as monitor and critic. In some advanced mathematical thinking, it has been seen that students in a university course train their thinking to methodically check and override their thinking if needed.
In Object Oriented Design often, software developers are often hijacked by S1, where the complex domain of OOD requires formal training and effortful thinking. In a study, programmers were given the task of creating a scheme for a software system. When trying to make a system for trying to handle hotel reservations, they found that people often reversed the direction of inheritance. Using 3 classes to make reservations (email, fax, phone), when asked if one class could inherit from another class, for instance, fax is like email except with more tests, one could inherit from the other. On this topic, the groups were often found to be split between which way the inheritance should take place.
Here, it is thought that the S1 takes over our process of thinking and produces a response that is roughly appropriate. Here someone’s notion of inheritance is that something transfers between things and the intuition is that that one that is giving has more.
People have difficulties in identifying objects.
Ron: Client is also an object. Login and register are
activated and operate within the system; therefore
they can be defined as objects.
Sharon: I’ve never seen an object login.
Ron: Don’t worry, it will be okay. You’ll see how I
design the system; it will be just fine.
Sharon [hesitates, at last reluctantly giving in]:
Okay, fine, although it doesn’t sound good.
Here Ron’s behavior is a typical S1 behavior, although because he needs more than a nudge in the righr direction, it shows that he does not have a firm grasp of the knowledge. Sharon on the other hand, sees something wrong with making login an object but can’t explain her reasoning well, showing that her intuition is correct in this situation(and that she is using past experience).
Confusing Characteristics of abstract and concrete classes
People recognize the distinction between and concrete and abstract class in theory, but it was observed that in several cases they referred to an abstract class as if that had the characteristics of a concrete class. In some written solutions, people would make an abstract class and use it as a concrete class.
Identifying software development with coding
Ann: Most of the time I was occupied with development.
Researcher: What do you mean development?
Ann: You know, writing the code. For me coding
and developing are the same thing, even though I
know this is not correct.
Here, the S1 identifies development with coding, although when given a nudge, she states how this is not correct as she knows design and analysis are involved, here the S1 is clashing with the S2.
HOW INTUITIVE IS OO DESIGN?
It is indeed intuitive, as it is built upon the ideas of our cognitive system. In the evolution of the formal system of OOP, the demands of the paradigm sometimes clash with the intuitions that produced it.
Conclusion
Intuition is a powerful tool to nagiate through most of every day life, but it can get in the way. Keep this in mind to better understand the problem and hopefully this will point the way to thinking about a solution.
Original Paper: