Java Reference
In-Depth Information
Analyze the Requirements — Phase 1
When a programmer receives a requirements document or similar
assignment, the first step is to make sure that the requirements are clear and
complete. If equations are included, they need to be correct and precise. If
necessary, the programmer must request that the requirements document be
revised to address these issues.
Next, the programmer must evaluate the problem to determine that, indeed,
it is solvable with a computer program. One way to do this is for the program-
mer to make a list of the required input and output data. The programmer must
also determine whether input data is available for testing purposes. Figure 1-11
shows a sample list of inputs and outputs, along with test data for the Shipping
Charge Calculator application.
INPUTS AND OUTPUTS
INPUTS
OUTPUTS
Shipment Weight
Shipping Charge
SAMPLE DATA
INPUTS
OUTPUTS
16 ounces
$12.95
10 ounces
$12.95
26 ounces
$15.95
FIGURE 1-11
The next step is for the programmer to verify that the provided information
explains how to convert the input data into output data so that a solution, or
algorithm , can be developed. The requirements document must clearly state the
rules that govern how to convert the input into output. The requirements docu-
ment in Figure 1-10 on the previous page describes the algorithm in words and
in mathematical formulas. When writing an algorithm, consider that the goal of
computer programming is to create a correct and efficient algorithm that is a
clear and unambiguous specification of the steps needed to solve a problem.
Correct refers to using logical constructs and valid data in an organized way so
that the steps will be carried out correctly and the program will make suitable
responses to invalid data, such as displaying a warning message for numbers out-
side a given range. Efficient refers to the program's ability to deliver a result
quickly enough to be useful and in a space small enough to fit the environment.
For instance, if a program to look up a price on a product takes more than a few
seconds, customers may become impatient; or if a computer game takes an enor-
mous amount of memory and hard disk space, it will not be marketable. Com-
puter programs should be as straightforward as possible in the certain event that
modifications and revisions will need to be made.
The requirements also must state how the user will interact with the
program, such as whether the program must be made available in a windowed
application with a graphical user interface, as an applet for Web users, or as a
 
Search WWH ::




Custom Search