Program Development Cycle
Program Development Cycle
Program Development Cycle
So we use languages that we know as well as there are some ways of converting
this to machine language. It is very hard to convert natural languages, so
special programming languages have been developed similar to natural
languages (specially in English). Therefore these are easy to learn. These
programming languages are used to develop computer programs that give the
computer a detailed set of instructions to execute.
It is very tempting to start entering your program into the computer as soon as
you have some idea of how to write it. Instead, you need to analyse the problem
and its solution before you write any program instructions.
It has been clearly demonstrated that time spent defining the problem to be
solved and then designing the solution leads to more efficient programming
and fewer errors in the program.
1. Problem definition.
2. Development of a solution.
3. Testing of the solution.
4. Coding of the solution.
5. Testing the program.
6. Maintenance and documenting the program.
1. PROBLEM DEFINITION
This stage is the most important because all subsequent stages are dependent
on it. Problem definition involves analysing the problem until a clear
understanding is reached. Without a clear understanding of the problem, time
and effort spent on later stages can be wasted. It may be necessary to have a
discussion with the person who proposed the problem to clarify issues.
The program specification should also include known results for given inputs
to the program. Sometimes these known results are termed as test cases.
These known results can be used as a guide to the successful solution of the
problem.
An IPO chart is a tool that can be used to help document the problem
definition.
An IPO chart is a table that specifies the input, processing and output
requirements of the program.
An accessory to the IPO chart is a list of names for each of the input and
output data storage. These names are easier to use than a full text description
of an item and can lead to the removal of ambiguity. This list is referred to as
the Initial Data Dictionary. Other data items, which are neither input nor
output, are added to this list as the processing steps are developed. The
complete list of data items used in a program is referred to as the Data
Dictionary for the program.
2. DEVELOPMENT OF A SOLUTION
The technique of top-down design in the development of a solution involves
breaking the problem down into a number of tasks to establish an outline of
the solution, and then breaking these tasks down into sub-tasks until the
solution of each task is manageable.
The set of logical steps that describe the actions to be carried out in each task
to solve the overall problem is called an algorithm.
A technique for testing the algorithm with test data is the desk check. This is a
step-by-step walk-through of the logic of the algorithm to see how the input is
transformed into output. This is a paper (or whiteboard) exercise that is carried
out before the program code is entered on the computer. If the results from the
desk check do not match the expected results it is necessary to return to stage
2 to modify the algorithm. The modified algorithm is then retested and modified
until the expected results are obtained for the test data. Since the conclusions
derived from a desk check are only as good as the test data, it is necessary to
design comprehensive test data, which should test all conceivable conditions.
4. CODING THE PROGRAM
The commands of a programming language are used to transform the algorithm
into a computer program after the logic of the program has been planned. Any
programming language can be used to code the algorithm, however a particular
language may be more suitable than others depending on the type of problem.
During the coding of the program it is good practice to include comments that
explain the logic of the processing steps. These comments will make it easier to
understand the program at a later date and make the maintenance of the
program easier.
The compiler detects and displays syntax errors as it attempts to translate the
program. If the program contains a syntax error, it cannot be translated and
the program cannot be executed.
Syntax errors occur if the rules of the programming language (the syntax) are
not adhered to. This may occur when reserved words (words that have special
meaning to that programming language) are misused, misspelled or
punctuated incorrectly. These syntax errors must be corrected before the
program can be run. The program code is stored in a text file, which can be
printed from the program editor, a text editor, or a word processing package.
The program listing is the documentation for this stage.
Run-time errors are detected and displayed during execution of the program.
They occur when the program instructs the computer to perform an illegal
operation, such as subscript out of range, dividing a number by zero, type
mismatches or manipulating undefined or invalid data. When a run-time error
occurs, the computer stops program execution and displays an error message.
5. TESTING THE PROGRAM
This step involves running the program with the same test data used to test the
algorithm. If the output does not match the expected results it indicates that
errors have been made in converting the algorithm into program code.
Debugging the program is the process that identifies these errors.
One document that is developed over several of the stages in the program
development cycle is the Data Dictionary. This is an alphabetic list of the
names of all the data items used by the program. It includes a description of
the data item and the type of data. The initial data dictionary from the problem
definition stage is added to during algorithm development and during coding as
extra data items are used in the steps to convert the input to output.
Once the program has been thoroughly tested, the documentation should be
reviewed to ensure consistency between the materials produced at each stage.
1. Program specification.
2. IPO chart.
3. Hierarchy or structure chart.
4. Algorithm in pseudocode or NS diagrams or flowcharts.
5. Test data and desk check.
6. Program listing.
7. Results of testing the program.
It is likely that the program will be changed at some time after it has been
successfully designed and tested. Errors may occur or modifications may be
requested. As changes are made they should be documented and the materials
from each stage modified to reflect those changes.
PROBLEM DEFINITION
A program specification is a formal way of documenting what a computer
program is to do. The format of a program specification should contain the
following:
5. The OVERALL TASKS, i.e. the broad solution steps (the highest level of
top-down design) or an overall view of the tasks the program will have to
perform.
3. It gives the programmer an excellent starting point for thinking about the
details of the algorithm.
Below is an example of a program specification.
Example 1.1
DESCRIPTION
PROCESSING
OVERALL TASKS
1. Initialisations
2. Input and validate order details or END
3. Calculate order cost
4. Update statistics
5. Print details of order
6. Print statistics for all orders entered
Exercise 1
In each of the following write a program specification.
1. POST0: A program outputs to the screen the postage charge for a parcel
when the weight of the parcel (in Kg) is entered from the keyboard. The
charge is set at $1.50 per kg.
5. RECT0: A program accepts the height and width of a rectangle from the
keyboard, calculates the perimeter and area of the rectangle and outputs
the results to the screen.
The last section of a program often involves output. This can be in the form of
a report displayed on the screen or output to a printer, or it could be
information written to some sort of storage device, such as disk or tape.
Example 1.2
Problem definition:
An analysis of the problem indicates a single input and a single
output. The input has to be converted to the output.
IPO CHART
INPUT PROCESSING OUTPUT
Temperature in 1. Enter the Temperature in
degrees Celsius temperature in degrees degrees Fahrenheit
Celsius
2. Convert the
temperature in degrees
Celsius to the
temperature in degrees
Fahrenheit
3. Display the
temperature in
degrees Fahrenheit
Note: The precise details of converting a temperature in degrees Celsius to a
temperature in degrees Fahrenheit are not required at this stage. It is sufficient
to describe what is to be done, not how it will be done.
The IPO chart should now be analysed and modified until the following
questions are satisfied:
1. Are all the inputs required for the processing steps specified?
2. Are all of the required outputs specified?
3. Do the processing steps transform input to output?
Exercise 2
Problem 1:
Using an IPO Chart, determine how an employee's gross pay and net pay
is determined. The employees would need to be prompted to enter their
hours worked and the hourly rate. The result would be displayed on the
screen.
where
gross pay = hours worked x hourly rate
tax amount = 10% of gross pay
net pay = gross - tax amount
Problem 2: