Skip to main content
ScotlandComputer ScienceSyllabus dot point

How do you plan the structure and logic of a program before writing any code?

Design notations used to describe a solution: structure diagrams, flowcharts and pseudocode, and the design of the user interface (wireframes).

An SQA Higher Computing Science answer on design notations, covering structure diagrams, flowcharts and pseudocode for program logic, and wireframes for user-interface design.

Generated by Claude Opus 4.811 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this key area is asking
  2. Why design before coding
  3. Structure diagrams
  4. Flowcharts
  5. Pseudocode
  6. Wireframes: designing the user interface
  7. Examples in context
  8. Try this

What this key area is asking

The SQA wants you to know the design notations used to plan a solution before coding: structure diagrams, flowcharts and pseudocode for the program logic, plus wireframes for the user interface. You should be able to read and produce these, and to design an algorithm from a problem.

Why design before coding

Jumping straight to code on anything non-trivial leads to tangled, hard-to-fix programs. A design is a plan that lets you reason about the solution, divide the work, agree it with others and spot problems cheaply, before writing a single line. The Higher course expects you to design both the logic and the interface.

Structure diagrams

Designing this way (called top-down design with stepwise refinement) produces a modular program: each box becomes a procedure or function that can be written, tested and reused independently. It also gives a clear overview that is easy to talk through with a client.

Flowcharts

A flowchart shows the step-by-step flow of control using standard shapes:

  • A rounded box (terminator) marks the start or stop.
  • A parallelogram shows input or output.
  • A rectangle shows a process (a calculation or assignment).
  • A diamond shows a decision, with branches labelled for the yes/no outcomes.
  • Arrows join the shapes to show the order of execution.

Flowcharts make selection and iteration visible as branches and loops, and are good for explaining a single algorithm clearly. They become unwieldy for large programs, where pseudocode or a structure diagram is clearer.

Pseudocode

Pseudocode is the workhorse design notation at Higher. It captures the precise logic (loops, conditions, calculations) while staying readable, so it can be written quickly, reviewed easily and then implemented in any language.

Wireframes: designing the user interface

The user interface is designed with a wireframe: a simple, unstyled sketch of the screen layout showing where the headings, input fields, buttons, navigation and output areas go. A wireframe focuses on structure and usability, not colours or final graphics, so the layout can be agreed and improved before any code or styling is written. For a quiz app, a wireframe would show the question text area, the answer buttons, a score display and a "next" button, positioned on the screen.

Examples in context

Professional developers design before coding for the same reasons: large systems are sketched as module/architecture diagrams (the structure-diagram idea scaled up), interface designers produce wireframes in tools such as Figma before any front-end code, and algorithms are often worked out as pseudocode in a design document or even on a whiteboard at interview. In the SQA assignment you must produce a design (often pseudocode plus a wireframe) as evidence, and the marker checks your code against it.

Try this

Q1. Name the design notation that breaks a problem top-down into a hierarchy of sub-problems. [1 mark]

  • Cue. A structure diagram.

Q2. State the flowchart shape used to represent a decision. [1 mark]

  • Cue. A diamond.

Q3. State what a wireframe is used to design and one thing it deliberately leaves out. [2 marks]

  • Cue. It designs the layout of the user interface; it leaves out final styling such as exact colours and graphics.

Exam-style practice questions

Practice questions written in the style of SQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

SQA Higher (style)4 marksA program reads 20 exam marks, then displays how many are 50 or above. Using pseudocode, design an algorithm for this task.
Show worked answer →

A correct design uses a fixed loop and a counter (the count-occurrences pattern).

1. SET passCount TO 0
2. FOR counter FROM 1 TO 20 DO
3.    RECEIVE mark FROM (keyboard)
4.    IF mark >= 50 THEN
5.       SET passCount TO passCount + 1
6.    END IF
7. END FOR
8. SEND passCount TO (display)

Markers reward initialising the counter before the loop, a fixed loop running exactly 20 times, the correct condition (mark >= 50), incrementing inside the IF, and displaying the result after the loop. Equivalent SQA reference-language pseudocode or a correct flowchart also earns the marks.

SQA Higher (style)3 marksExplain what a structure diagram shows about a program, and state one advantage of designing with a structure diagram before coding.
Show worked answer →

A structure diagram shows the program broken down into its sub-problems arranged as a hierarchy: the overall task at the top, divided into smaller tasks beneath it, refined until each box is a step simple enough to code. It shows the modular structure and how the parts relate, not the line-by-line logic.

One advantage: it encourages a modular, top-down design, so the problem is divided into manageable sub-programs that can be written and tested independently and reused. (Other valid advantages: it gives an overview that is easy to discuss with a client, and it makes the program easier to maintain.)

Markers reward describing the diagram as a top-down hierarchy of sub-problems and a valid advantage such as modularity, reuse, or a clear overview.

Related dot points

Sources & how we know this