Design

The design is very important, the programmer needs to work out the details of the program. The programmer will consider the user interface and structure of the program.

Stepwise Refinements

This is a method of taking a large problem and breaking it down into smaller more manageable problems. 

Stepwise refinement is also called top down design as the process is started as one problem at the top and worked down into smaller problems. 

Two common notations for program design are pseudocode and structure diagrams

Pseudocode

Problem– teacher wishes to calculate the average mark of 3 end-of-topic tests and display the results. 

Main Algorithm 

  1. Get input values 
  2. Perform Calculation 
  3. Display output 

Refinements for step 1 

1.1   RECEIVE pupilname FROM (STRING) KEYBOARD 

1.2   RECEIVE pupilmark1 FROM (INTEGER) KEYBOARD 

1.3   RECEIVE pupilmark2 FROM (INTEGER) KEYBOARD 

1.4   RECEIVE pupilmark3 FROM (INTEGER) KEYBOARD 

Refinements for step 2 

2.1   SET totalmarks TO pupilmark1 + pupilmark2 + pupilmark3 

2.2   SET average TO totalmarks/5 

Refinements for step 3 

3.1   SEND [“The total mark is:” & totalmarks] TO DISPLAY 

3.2   SEND [“The average score is:” & average] TO DISPLAY

Note: The difference between an algorithm and pseudocode

  • An algorithm is a well-defined  sequence of steps that provides a solution for a problem.
  • Pseudocode is the language that the design is written in. 
  • Please note this is not proper English but not a High Level Language either. 

Structured Diagram

 

Flow Chart

The owners of a theme park have asked that a program be developed to record the average number of visitors in a week.   user will enter the total number of visitors for each day of the week.  The program should then output the average number of visitors across the week.

Interface

A user interface is the part of software that the user sees and interacts with.  The user interface often includes features that allow the user to input data and includes areas where the user will see on-screen output. When designing user interfaces, it is common practice to create wireframes.