Sunday, March 7, 2010

Object Orientation as a New Paradigm: The Big Picture

It is claimed that the problem-solving techniques used in object-oriented programming
more closely models the way humans solve day-to-day problems.3
So lets consider how we solve an everyday problem: Suppose you wanted to send
flowers to a friend named Robin who lives in another city.To solve this problem you
simply walk to your nearest florist run by, lets say, Fred. You tell Fred the kinds of
flowers to send and the address to which they should be delivered. You can be assured
that the flowers will be delivered.
Now, lets examine the mechanisms used to solve your problem.
• You first found an appropriate agent (Fred, in this case) and you passed to this
agent a message containing a request.
• It is the responsibility of Fred to satisfy the request.
• There is some method (an algorithm or set of operations) used by Fred to do
this.
• You do not need to know the particular methods used to satisfy the request—
such information is hidden from view.

Off course, you do not want to know the details, but on investigation you may find
that Fred delivered a slightly different message to another florist in the city where
your friend Robin lives. That florist then passes another message to a subordinate
who makes the floral arrangement.The flowers, along with yet another message, is
passed onto a delivery person and so on. The florists also has interactions with wholesalers
who, in turn, had interactions with flower growers and so on.
This leads to our first conceptual picture of object-oriented programming:
An object-oriented program is structured as community of interacting agents
called objects. Each object has a role to play. Each object provides a service
or performs an action that is used by other members of the community.

No comments:

Post a Comment