Java Reference
In-Depth Information
Who designs these objects? Other programmers! What do they contain? Other
objects! This is where things get confusing for beginning students. In real life, the
users of black boxes are quite different from their designers, and it is easy to
understand the levels of abstraction (see Figure 1 ). With computer programs, there
are also levels of abstraction (see Figure 2 ), but they are not as intuitive to the
uninitiated. To make matters potentially more confusing, you will often need to
switch roles, being the designer of objects in the morning and the user of the same
objects in the afternoon. In that regard, you will be like the builders of the first
automobiles, who singlehandedly produced steering wheels and axles and then
assembled their own creations into a car.
There is another challenging aspect of designing objects. Software is infinitely
more flexible than hardware because it is unconstrained from physical limitations.
Designers of electronic parts can exploit a limited number of physical effects to
create transistors, capacitors, and the like. Transportation device manufacturers
can't easily produce personal helicopters because of a whole host of physical
limitations, such as fuel consumption and safety. But in software, anything goes.
With few constraints from the outside world, you can design good and bad
abstractions with equal facility. Understanding what makes good design is an
important part of the education of a software engineer.
84
85
3.1.3 Crawl, Walk, Run
In Chapter 2 , you learned to be an object user. You saw how to obtain objects, how
to manipulate them, and how to assemble them into a program. In that chapter, your
role was analogous to the automotive engineer who learns how to use an engine
control module, and how to take advantage of its behavior in order to build a car.
In this chapter, you will move on to implementing classes. A design will be handed
to you that describes the behavior of the objects of a class. You will learn the
necessary Java programming techniques that enable your objects to carry out the
desired behavior. In these sections, your role is analogous to the car parts
manufacturer who puts together an engine control module from transistors,
capacitors, and other electronic parts.
In Chapters 8 and 12 , you will learn more about designing your own classes. You
will learn rules of good design, and how to discover the appropriate behavior of
Search WWH ::




Custom Search