Software Development Method (1.4 and 1.5)
Main steps:
1. Specify the Problem
Requirements
·
Get a statement
of the problem
·
Understand what
is being asked for
Example:
A customer comes with the requirement for a program
that converts number of miles to number of kilometers. The customer explains
that users will input number of miles form the keyboard and that they expect to
be shown the result on the computer screen in a neat format.
2. Analyze the Problem
·
List the problem
inputs
·
List the problem
outputs
·
List other
variables you may need to keep track of
·
List any formulas
that may be relevant
·
Decide on the
names and types of variables
·
Decide how
instructions and results are displayed
Example:
Problem Inputs: kilometers (distance in kilometers)
Problem Outputs: miles (distance in miles)
Additional Variables: none
Formulas: 1 mile = 1.609 kilometers
3. Design the Algorithm to
Solve the Problem
·
Develop a list of
steps (called an algorithm) to solve
the problem. Make sure (on paper) that the algorithm is correct. This step
requires problem-solving skills!
·
Don't attempt to
solve every detail at once. Use top-down
design (it is also called divide and
conquer). This process is similar to writing a term-paper (p.23):
·
List major steps
of the algorithm (define subproblems)
·
Solve subproblems (algorithm
refinement)
·
Common structure
of every algorithm:
o
Get the data
o
Perform
computations
o
Display results
Example:
Outline of the conversion algorithm:
1. Get the distance in miles
2. Convert the distance to kilometers
3. Display the distance in miles
Refinement of step 2:
2.1. kilometers =
1.609 * miles
4. Implementation
Write
(or code) each step of the algorithm in C programming language.
Example: Figure 1.14
5. Test and Verify the
Completed Program
Compile and debug the
program
Check
if program works correctly:
·
Validate the
program output for several representative test
cases that you calculate by hand
·
Do not rely on a
single test case – run the program several times using different inputs
·
Check how robust
the program is (how easy is to break it)
Document
the testing procedure in the program header. It will tell people how hard you
tried to make sure your code is foolproof
6. Maintain and Update the
program
Often,
there is a need to modify the program to meet changed requirements
In
this phase, it becomes apparent why it is important to keep the code neat and
well documented
Failure is the Natural Part of the
Process!!
The
first attempt at the solution is rarely completely correct
Do
not be discouraged by initial failures