Java Reference
In-Depth Information
Concepts are discovered through the process of abstraction, taking away inessential
features, until only the essence of the concept remains. For example, Ȓcarȓ is an
abstraction, describing devices that transport small groups of people, traveling on
the ground, and consuming gasoline. Is that the right abstraction? Or is a vehicle
with an electric engine a Ȓcarȓ? We won't answer that question and instead move on
to the significance of encapsulation and abstraction in computer science.
3.1.2 Object-Oriented Design
In old times, computer programs manipulated primitive types such as numbers and
characters. As programs became more complex, they manipulated more and more
of these primitive quantities, until programmers could no longer keep up. It was just
too confusing to keep all that detail in one's head. As a result, programmers gave
wrong instructions to their computers, and the computers faithfully executed them,
yielding wrong answers.
Of course, the answer to this problem was obvious. Software developers soon
learned to manage complexity. They encapsulated routine computations, forming
software Ȓblack boxesȓ that can be put to work without worrying about the
internals. They used the process of abstraction to invent data types that are at a
higher level than numbers and characters.
At the time that this topic is written, the most common approach for structuring
computer programming is the object-oriented approach. The black boxes from
which a program is manufactured are called objects. An object has an internal
structureȌperhaps just some numbers, perhaps other objectsȌand a well-defined
behavior. Of course, the internal structure is hidden from the programmer who uses
it. That programmer only learns about the object's behavior and then puts it to work
in order to achieve a higher-level goal.
83
84
Search WWH ::




Custom Search