Design Techniques
Types of Design Notations
During the course we will discuss the following types of notations, these may be used across a variety of problems.
Textual
Pseudocode
Graphical
Wireframes
Flow Charts
Structure Diagrams
Pseudocode
Pseudocode is a textual design notation. It is written in a mix of code and english but is not written in any specific programming language. It used by the programmer to help design the main steps of their program.
One line of pseudocode should be equivalent to roughly one line of code.
Main Steps and Refinements
The main steps are numbered as 1,2,3. And these steps can be refined (expanded) into smaller steps - 1.1, 2.1, 3.1 etc
1 Inputs:
1.1 User inputs the Pupil Name
1.2 User inputs the Prelim Mark
1.3 User inputs the Assignment Mark
2 Processes
2.1 percentage = (prelim mark + assignment mark/160)
2.2 percentage = percentage rounded to 2 decimal places
3 Output
3.1 For every pupil
3.2 Display the name of a pupil with their prelim and coursework mark
3.2 Display the pupil's percentage
3.3 Next pupil
Assignment and Input/Output
Variables are assigned and updated using the following assignment statement:
SET variablename TO value
Examples:
counter TO counter + 1
answer = length * breadth
To receive or send a value from keyboard:
username = Input from user
age = Input from user
Display passmark
Conditions
Conditional commands have the form:
IF expression THEN command END IF
or
IF expression THEN command ELSE command END IF
Examples:
IF a > 3
Display “more than three”
END IF
IF mark > 70
Display “You gained a merit!”
ELSE IF mark > 50
Display “Well done you have passed”
ELSE
Display “Sorry you have not passed”
END IF
Repetition
Repetition occurs when either a fixed or conditional loop is being used.
Example
FOR counter FROM 1 TO 5 DO
Display counter
END FOR