Page 356 - Introduction to Programming with Java: A Problem Solving Approach
P. 356

                322 Chapter 8 Software Engineering
for that class. Whenever we do that, we are using a bottom up presentation, and we are inviting you to think about the program being described from the bottom up.
Bottom-up design also makes it easiest for you to use prewritten software, like that in the Java API and described previously in Chapter 5. The Java API is a particularly good source for prewritten software be- cause its code is (1) optimized for high speed and low-memory consumption and (2) highly reliable because it has undergone testing and debugging for years. It’s good to use the Java API, but it takes time to learn how to use it. To learn about the Java API, see Sun’s Java API Web site at http://java.sun.com/javase/6/docs/api/. There, you’ll find several ways to look things up. Here are two techniques:
1. Try guessing the name of a class that seems appropriate. Use the scrollbar in the classes frame to search for the guessed class name. There are about 4000 classes so finding a particular class requires a well-behaved mouse (we recommend proper diet and exercise to keep your mouse running smoothly). When you find a class name that looks promising, click on it and read about its public constants and methods.
2. Related classes are grouped together in about 166 packages. Use the scrollbar in the packages frame to find a package that looks promising. Click on that package and scroll through its classes. Again, when you find a class name that looks promising, click on it and read about its public constants and methods.
Using pre-written software for your low-level modules reduces development time and project cost. It also improves product quality, because presumably the pre-written parts of your program have already been thoroughly tested and debugged. As in the case of Java API code, you’ll often find that pre-written low-level software is quite flexible, because it was designed for a broad spectrum of applications. This inherent low- level flexibility will make it easier for you to expand the capabilities of your program when you upgrade it in the future. Using pre-written softAwapreacagn foacilitPateDpaFrallelEdenvehlopamnentc. Ifeserveral different programmers want to use a common subordinate module, they can do it independently. They do not have to coordinate their efforts, because that module’s design is already established and stable.
Another benefit of bottom-up design is that it provides freedom to implement tasks in the most benefi-
              Work on most critical problem first.
cial order. If there’s a significant concern as to whether a particular calculation is feasible, it’s important to begin working on that calculation as soon as possible. With bottom-up design, there’s no need to wait around to address the concern—just attack it immediately. That way, you can determine at the earliest possible time whether the concern will be a
 show stopper. Likewise, if there is some low-level task that will take a long time to complete, bottom-up design allows you to begin work on it immediately and avoid a potential bottleneck later.
There are several drawbacks to using bottom-up design, however. As compared to top-down design, bottom-up design provides less structure and guidance. It’s often hard to know where to start, and because development is hard to predict, bottom-up programming projects are hard to manage. In particular, with less inherent guidance, it’s harder for managers to keep their programmers on track. As a result, programmers might spend significant amounts of time working on code that may not be relevant to the final program. Another drawback in using bottom-up design is that it can lead to difficulties in getting the final product to conform precisely to design specifications. Top-down design facilitates conformity by addressing specifica- tions in detail at the beginning. With bottom-up design, specifications receive only superficial consideration at the beginning.
So, when should you use bottom-up design? When you can use a substantial amount of pre-written and pre-tested low-level software, the bottom-up design process makes it easy for you to design around that software so that it fits naturally into your complete program. When you can use a substantial amount of pre-written software that is open to your inspection and already designed to fit together (like Java API software4), bottom-up design simultaneously promotes high quality and low cost. When low-level details are























































































   354   355   356   357   358