Lesson-2_3-Program-Development-Cycle
Lesson-2_3-Program-Development-Cycle
have been here employee? Should the list contain both first and
last names? Social Security numbers? Phone
over five years,
numbers? Addresses?
because we want
Should the list be in alphabetical order? Employee
to invite them to a
ID number order? Length-of-service order? Some
special thank-you
other order?
dinner.”
Should the employees be grouped by any criteria,
such as department number or years of service?
Documentation
During this phase of the process, the programmer plans the steps of
the program, deciding what steps to include and how to order them.
If there are no
syntax errors
Write and correct Compile the Executable
the program code program program
If there are
syntax errors
List of
syntax Program
error output
message
Once a program is free of syntax errors, the programmer can test it—
that is, execute it with some sample data to see whether the results are
logically correct.
If you execute the program, provide the
input myNumber value 2 as input to the program, and the
answer 4 is displayed, you have executed
set myAnswer = myNumber * 2
one successful test run of the program.
output myAnswer
However, if the answer 40 is displayed, maybe the program contains a logical error.
The process might take months if the program will be run on a regular
basis, or if it is one of a large system of programs being developed.
Pseudocode Flowchart
An English-like representation of the A pictorial representation of the same
logical steps it takes to solve a thing.
problem.
get myNumber
input myNumber
read myNumber
display myAnswer
output myAnswer print myAnswer
write myAnswer
Drawing Flowcharts
stop
start
Flowchart Pseudocode
input myNumber
start
input myNumber
set myAnswer = set myAnswer = myNumber * 2
myNumber * 2
output myAnswer
stop
output myAnswer
stop
start
input myNumber
set myAnswer = myNumber * 2
output myAnswer
input myNumber
set myAnswer = myNumber * 2
output myAnswer
input myNumber
set myAnswer = myNumber * 2
output myAnswer You would never want to write
…and so on for 9,997 more times such a repetitious list of
instructions.
Figure 1-7 Inefficient pseudocode for program that doubles 10,000 numbers
Figure 1-8 Flowchart of infinite number-doubling program
You represent a decision in a flowchart
by drawing a decision symbol, which is
shaped like a diamond.
myNumber = 0?
The diamond usually contains a question,
the answer to which is one of two
mutually exclusive options—often yes or
no.
start
Yes
myNumber = 0? stop
No
set myAnswer =
myNumber * 2
output myAnswer