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

                critical, bottom-up design motivates you to deal with the tough problems first—it gives you the most time to solve them. Thus, bottom-up design can also help you minimize delivery time.
A familiar example of bottom-up software design is the early development of the Microsoft Windows
operating system. The original version of Windows was built on top of the already existing and successful
5
DOSoperatingsystem. ThenextmajorversionofWindowswasbuiltontopofanovellow-levelsoftwarecore
called “NT” (for New Technology). It’s important to note that the component source code in these cases was
6
There is another basic way to solve problems and design things. It’s what normal people do most of the time in their everyday lives. Instead of going through a formal top-down or bottom-up sequence of steps, you look around for an already-solved problem that’s like the problem at hand. Then you figure out how that problem was solved, and you modify that solution to fit your problem. This approach is holistic. It starts with a whole solution and “bends” that whole solution to a different application.
If you have access to source code and the right to copy it or modify it and then redistribute it in a new
context, you can modify an existing program or significant parts of existing code. Sometimes the code you
want to borrow is code you wrote yourself for a different application. Such code deserves your consider-
ation, because you’ll be intimately familiar with what it does and how it does it. For example, many of this
book’s projects were designed to show you how to solve a wide range of real-world problems. You can use
the algorithms presented in the project assignments to generate Java code that solves particular versions of
always open to and under the control of system developers, because it was all owned by the same company.
8.8 Case-Based Design
those problems. Once you have written that code, you’ll be completely free to modify it and re-use it in any
Apago PDF Enhancer
other context to solve other variations of those problems.
Frequently, the code you’d like to use will be code that somebody else wrote. Would it be theft or pla-
giarism to use such code? It might be. If the code is copyrighted, and you don’t have permission to use it, you shouldn’t try to use it. But you might have permission to use it. Whenever you use code that somebody else wrote, be sure to acknowledge and identify your source.
There is a growing body of what’s called “free” software7 that is debugged and maintained by a select body of experts, and it’s available to all people to use and modify for their own purposes, provided they conform to certain reasonable rules. Basically, these rules are: acknowledge the source, and don’t try to make a profit on resale of the original code. Sometimes this software is low-level code that you can use like Java API software. But sometimes it’s a complete program, which you can adapt to a problem you’re currently addressing.
4 Although we have been encouraging you to think of Java API software as being completely encapsulated, Sun does not keep the Java API source code secret. It can be downloaded and is available for inspection by Java developers.
5 The set of commands you can enter into a Microsoft Windows command-prompt window are essentially DOS commands—they are a software legacy of the IBM PC that came out in the early 1980s.
6 In principle, it’s possible to build software systems out of components that are Commercial-Off-The-Shelf (COTS) programs from different companies. This strategy can be used to avoid “reinventing the wheel” in a big way, and it minimizes new code to the “glue” that provides component interfaces. However, it takes longer to write this glue code than it does to write ordinary code. Moreover, since (in general) the system developer does not have access to component source code and does not have control of component evolu- tion, the development process is relatively risky, and the resulting composite program is relatively brittle. COTS-based system design has a distinctive methodology that is outside the scope of this text.
7 See http://www.fsf.org. The Free Software Foundation is “dedicated to promoting computer users’ rights to use, study, copy, modify, and redistribute computer programs.” Two famous examples of this kind of software are the GNU/Linux operating system (GNU stands for “Gnu’s Not Unix” ) and the Apache software that underlies most Web servers (http://www.apache.org).
8.8 Case-Based Design 323
  







































































   355   356   357   358   359