TOPIC 3.2. FEATURES OF PROCEDURAL PROGRAMMING LANGUAGES

TOP-DOWN DESIGN

JACKSON STRUCTURE DIAGRAMS

 

THE BUILDING BLOCKS OF A STRUCTURED PROGRAM

Only three different 'building blocks' or program constructs are needed to write a structured program. These are:

  1. Sequence - in which one statement follows another and the program executes them in the sequence given.
  2. Selection - 'if..then..else' is an example of selection, where the next statement to be executed depends on the value of an expression.
  3. Iteration - a section of the program is repeated many times, as for example in the 'while..do' statement.

REPRESENTATION OF A LOOP

while a<b do

    begin

          statement1

          statement2

          statement3

    end {endwhile}

REPRESENTATION OF SELECTION

if (answer = 'Y') or (answer = 'y') then

   statement 1

else

   statement 2

MODULAR PROGRAMMING

ADVANTAGES OF MODULAR PROGRAMMING

  1. Some modules will be standard procedures used again and again in different programs or parts of the same program; for example, a routine to display a standard opening screen.
  2. A module is small enough o be understandable as a unit of code. It is therefore easier to understand and debug, especially if its purpose is clearly defined and documented.
  3. Program maintenance becomes easier because the affected modules can be quickly identified and changed.
  4. In a very large project, several programmers may be working on a single program. Using a modular approach, each programmer can be given a specific set of modules to work on. This enables the whole program to be finished sooner.
  5. More experienced programmers can be given the more complex modules to write, and the junior programmers can work on the simpler modules.
  6. Modules can be tested independently, thereby shortening the time taken to get the whole program working.
  7. If a programmer leaves part way through a project, it is easier for someone else to take over a set of self contained modules.
  8. A large project becomes easier to monitor and control.

BOTTOM-UP DESIGN

 


RESOURCE:

P M Heatcote, [A level Computing, 3rd Edition], Ashford Colour Press Ltd, 1996.

Hosted by www.Geocities.ws

1