Review some common methods of representing designs are to use mock-ups, pseudocode and flowcharts. Each of these methods has a different purpose in the design stage
Mock-ups
If software will be used directly by people (rather than running hidden deep in the OS), it needs an interface – a place where people can control the program, enter data and receive output. A successful interface must be carefully designed to make it usable and clear.
To design an interface, use a mock-up, which is a sketch showing how a screen or printout will look. A mock-up should typically include the following features:
→the positions and sizes of controls such as buttons and scrollbars
→the positions, sizes, colours and styles of text such as headings and labels
→menus, status bars and scrollbars
→borders, frames, lines, shapes, images, decoration and colour schemes
→vertical and horizontal object alignments
→the contents of headers and footers.
A mock-up can be considered successful if you can give it to another person and they can create the interface without needing to ask you questions.
IF (year is divisible by 4 AND not divisible by 100)
OR (year is divisible by 4 AND 100 AND 400) THEN
it’s a leap year
ELSE
it’s not a leap year
ENDIF
another example
OPEN telein.txt
N ← int(first line)
directions ← second line
CLOSE telein.txt
visited ← empty set
position ← 0
add 0 to visited
FOR direction in directions DO
IF direction = "T" DO
position ← 0
ELSE IF direction = "R" DO
position += 1
ELSE IF direction = "L" DO
position -= 1
END IF
add position to visited
END FOR
OPEN teleout.txt
write length of visited
CLOSE teleout.txt
Writing an algorithm in source code is slow. An algorithm written in source code also limits itself to use in only one compiler. Pseudocode, also known as Structured English, is a quick, flexible and language-independent way of describing a calculation strategy – halfway between English and source code. Once the algorithm is described in pseudocode, it can be converted into source code for any desired programming language.
In pseudocode, make sure that you specify assignment (the storage of a value) using the ← symbol rather than the equals sign (=) that is used in algebra and in most real programming languages – for example:
isLeapYear ← True
The equals sign is reserved for logical comparisons, such as:
IF B=0 THEN SoundAlarm()
Common features found in pseudocode include:
→iterations/loops, such as WHILE/ENDWHILE and FOR/NEXT
→condition control structures, especially IF/ELSE/ENDIF blocks
→logical operators – AND, OR, NOT, TRUE and FALSE
→arrays, such as Expenses[3]
→records and fields, such as Customer.firstName, where Customer is the record and firstName is the field
→arithmetic operators (+ – * /) and the familiar order of operations, BODMAS.
Visual representation of a program can assist understanding the logical structure and flow of data. Flowcharts can contain general or specific level of detail about the operation of the logic of the program.
A flowchart is sequential. It has a start and an end, with an order of instruction execution. Loops are a means of representing choices or branching decisions.
Converting Pseudocode into Python