| Humans have been classifying things into "Objects" since
the dawn of history because it is our natural tendency to do so. Computer
languages that are oriented with these Object-Oriented Concepts tap into
this natural human tendency resulting in an easy to understand and use language.
Every programmer knows that ten small programs are easier to debug that
one program that is ten times larger. Several advancements have been made
towards this concept. Subroutines, Sub-functions and now Objects. Object-Oriented
programming will not, to be honest, live up to all the hype that you may
have heard. If you think it will make all programming automatic, and all
problems and bugs a thing of the past, you’ll be disappointed. Object-Oriented
programming is, however, a significant advancement, and every programmer,
that gains an understanding of Object-orientation, will become better and
more productive.
An
automobile is a very good example of the Object-Oriented Concept. As humans,
it is our natural tendency to think of an automobile as a single "thing",
and not as a large group of several thousand small "things". Thinking of
the automobile as a single "thing" helps us deal with the overwhelming complexity
of the whole machine. We would say simple statements like; "Fill her up."
or "How fast are we going?" or "I have a Blue car." ... and everyone would
understand how those statements apply to our car.
Using an automobile as an example of an Object, the following program
shows an example of Object Oriented programming
BobsCar.Speed = 50
If BobsCar.Speed > CurrentRoad.SpeedLimit Then
PoliceCar.Mode = Chase
PoliceCar.Target = BobsCar
PoliceCar.Speed = BobsCar.Speed + 10
End If
As shown in the example, the overwhelming complexity of Bob's car is
reduced down to a simple set of understandable terms.
|