Professional Documents
Culture Documents
2.
3.
4.
5.
6.
7.
The whole process of defining problems to providing the coded solution are an ongoing
process that is circular in nature and can be called the System Development Life Cycle
(SDLC).
Structured Programming
Structured programming assists the programmer to write effective error-free programs. This
term refers to a structured approach to program design using techniques such as Top-down
development and Modular design.
Top-down development
Traditionally a programmer when presented with a problem would start coding at the
beginning and work systematically though each step until reaching the end. Often the
programmer would get bogged down in the intricacies of a particular part of the problem,
rather than considering the solution as a whole. In top-down development of a program
design, a general solution to the problem is outlined first. This is then broken down gradually
into more detailed steps until finally the most detailed levels have been completed. It is only
after this process of stepwise refinement that the programmer starts to code. The result of
this systematic disciplined approach to program design is higher precision programming.
Modular design
Modular design involves grouping tasks together because they all perform the same function
e.g. the calculation of sales tax, or the printing of report headings. Modular design is
connected directly to top-down development, as the steps or subtasks which the programmer
breaks up the program solution into, will actually format the future modules of the program.
Good modular design also aids in the reading and understanding of the program.
The Structure Theorem
The Structure Theorem revolutionised program design by establishing a structured
framework for representing the solution. The Theorem states that it is possible to write any
computer program by using only three basic control structures. These control structures are:
1. Sequence
2. Selection, or IF-ELSE
3. Repetition, or WHILE, DO WHILE, FOR LOOP
There is currently no standard pseudocode. Different textbook authors seem to adopt their
own special techniques and set of rules, which often resemble a particular programming
language. But as a guideline, try the following conventions:
1. Statements are written in simple English
2. Each instruction is written on a separate line
3. Keywords and indentation are used to signify particular control structures
4. Each set of instructions is written from top to bottom with only one entry and one
exit
5. Groups of statements may be formed into modules and that group given a name
If a programmer uses words and phrases in his or her pseudocode that are in line with basic
computer operations, then the translation from the pseudocode algorithm to a specific
programming language becomes quite simple.
We could break down the computers operations into six basic operations and represent these
operations in pseudocode. Each operation can be represented as an English instruction with
keywords and indentation to signify a particular control structure:
1. A computer can receive information when a computer is required to receive information
or input from a particular source, whether it is a keyboard, disk or other source, the verbs
Read and Get can be used e.g.
Read student name
Get system date
Read number_1, number_2
Each example uses a single verb, Read or Get, followed by one or more nouns to indicate
what data is required to be obtained.
2. A computer can put out information when a computer is required to supply information
or output to a device the verbs Print, Write or Put could be used e.g.
Print student number
Write Program completed
Write customer record to master file
Put out name, address, postcode
3. A computer can perform arithmetic most programs require the computer to perform
some sort of mathematical calculation, or formula. You could use actual mathematical
symbols or the words for those symbols e.g.
Add Number to Total
Total = Total + Number
Divide Totalmarks by Studentcount
SalesTax = Costprice * 0.10
Compute C = (F 32) * 5/9
4. A computer can assign a value to a piece of data there are many cases where a
programmer will need to assign a value to a piece of information. Firstly to give data an
initial value in pseudocode the verbs, Initialise or Set can be used. Secondly to assign a
FILE=Programming Concepts and Design.doc by Greg Tisdell Updated on 23 March 2009
value as a result of some processing, the symbol = is written. Thirdly, to keep a piece
of information for later use the verbs Save or Store could be used e.g.
Initialise total accumulators to zero
Set StudentCount to 0
TotalPrice = CostPrice + SalesTax
Store CustomerNumber in LastCustomerNumber
5. A computer can compare two pieces of information and select one of two alternatives
an important ability is the comparison of two pieces of information and then as a result of
the comparison select on of two alternate actions. To represent this operation in
pseudocode the keywords IF, THEN and ELSE can be used e.g.
IF student is parttime THEN
Add 1 to parttimecount
ELSE
Add 1 to fulltimecount
ENDIF
Note the use of indentation to emphasise the THEN and ELSE options and the use of the
delimiter ENDIF to close the operation.
6. A computer can repeat a group of actions when there is a sequence of steps which need
to be repeated, the keywords DOWHILE and ENDDO could be used e.g.
DOWHILE studenttotal < 50
Read student record
Write student name, address to report
Add 1 to Studenttotal
ENDDO
Once again note the use of indentation. It is easy to read where the loop starts and ends.
Alternatives to the above could be WHILE and ENDWHILE..