Structured System Design
Structure

This word 'structure' keeps appearing.....what is it and why do we need to keep talking about it?

It really means...the way in which different parts are arranged and how they are linked together.

When designing a system it is important that the modules are simple enough to be easily understood by all the people who are going to be working on them...

....if they are easy to understand, then it is easy to create the system and to solve problems...

....if it is easy to solve problems, then there will be fewer errors.

Lack of structure means a confused, complex and error-riddled system which is difficult to sort out!

 

Modules in Programming

Top-down design is useful for tackling large programs.

In a program the modules are called subroutines (procedures and functions in Pascal).

Advantages of a modular approach to programming :

  • A small problem is easier to solve than a large one!
  • The modules can be shared out between a team of programmers.
  • Each module can be coded and tested separately.
  • Easier to debug if it is not working properly.
  • If changes need to be made it is easier to maintain small modules.
  • A library of modules can be stored for use in other programs.
  • A large project becomes easier to monitor and control.

Hints for programming

  • Always try to write subroutines that are as 'self-contained' as possible... (they do not depend on others)
  • Use local variables wherever possible.
  • Use parameters to make the subroutines as useful as possible - parameters are the interface to other subroutines and should be selected carefully.

Remember..a well-designed program...

  • ...is more likely to satisfactorily solve the intended problem,
  • ...will be less prone to errors
  • ...will be completed quicker as sections would not need to be re-written etc
  • ...will be easier for other programmers to understand if they need to alter it at a later stage.

 

Hierarchical representation of the design of an algorithm.

Hierarchical means something has different 'levels' which are 'related' in some way. (Think of a family tree of all your ancestors)

Example : A program is to be written which would create an invoice from a customer order for a clothing catalogue company.

The diagram shows how each stage has been broken down into 'smaller' tasks.

Create Invoice
Input order details Output Invoice
Input item
Code &
Qty
Find item
Price
Calculate
amounts
Print Invoice
Input
Code
Input
Qty
Open
Master
Data
File
Look
up
item
Price
Calculate
total
price
Calculate
discount
Calculate
VAT
Select
printer
Print
Invoice
details

...and so on...

Another Example :

The directories (folders) on a computer are stored in a hierarchy. The root directory is at the 'top', and has sub-directories. Each of these sub-directories may themselves have sub-directories etc...