Solution Evaluation Metrics (SQA National 5 Computing Science): Revision Note

Exam code: X816 75

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

Solution evaluation

What is solution evaluation?

  • Solution evaluation is the stage after testing where you judge how well the final program, database or website meets the original requirements

  • Evaluation links back to the iterative development process by identifying improvements for the next cycle

  • Evaluation focuses on three main factors:

    • Fitness for purpose

    • Efficient use of coding constructs

    • Robustness

Fitness for purpose

  • A solution is fit for purpose when it meets all functional and end-user requirements from the analysis stage

  • Evaluation requires checking the actual output against the expected output or design requirements

  • A solution that gives the wrong output is not fit for purpose even if the rest of the implementation is correct

  • Database evaluation must include checking the accuracy of SQL output

  • Any unmet requirement means the solution must be refined or corrected

Efficient use of coding constructs

  • Efficiency refers to solving the problem without unnecessary repetition or wasted computation

  • Fixed or conditional loops should be used instead of repeating blocks of code

  • Arrays should be used instead of declaring multiple variables for similar data

  • Nested IF or ELSEIF constructs should be used to reduce the number of comparisons

  • Efficient code improves performance and reduces maintenance effort

Inefficient version

  • This repeats the same code unnecessarily instead of using a loop

SET total TO 0

RECEIVE num1 FROM KEYBOARD
SET total TO total + num1

RECEIVE num2 FROM KEYBOARD
SET total TO total + num2

RECEIVE num3 FROM KEYBOARD
SET total TO total + num3

RECEIVE num4 FROM KEYBOARD
SET total TO total + num4
  • This is inefficient as:

    • The same instructions are repeated four times

    • The number of inputs cannot be changed easily

    • The structure makes the program longer and harder to maintain

Efficient version

  • This uses a fixed loop and an array to remove repetition

DECLARE nums[4]
SET total TO 0

FOR index FROM 0 TO 3 DO
    RECEIVE nums[index] FROM KEYBOARD
    SET total TO total + nums[index]
END FOR
  • This is efficient as:

    • A fixed loop removes repeated code

    • The number of inputs can be changed by adjusting the array size and loop range

    • The program is shorter, clearer and easier to maintain

Robustness

  • Robustness refers to the ability of the solution to handle unexpected or incorrect input without crashing

  • Robustness is achieved through appropriate input validation at every required point

  • Validation prevents invalid data from being processed and protects the program from runtime errors

  • Robust solutions continue running safely even when users enter incorrect or unreasonable data

Non-robust version

  • This version accepts invalid data and can break the program.

RECEIVE age FROM KEYBOARD
SET ticketPrice TO 10

IF age < 16 THEN
    SET ticketPrice TO 6
END IF

SEND ticketPrice TO DISPLAY
  • This is not robust as:

    • The program accepts anything the user types

    • A negative age or a text input like "abc" will cause errors

    • The program can crash or give incorrect results

Robust version

  • This version forces the user to enter a sensible age before the program continues

REPEAT
    RECEIVE age FROM KEYBOARD
UNTIL age >= 0 AND age <= 120

SET ticketPrice TO 10

IF age < 16 THEN
    SET ticketPrice TO 6
END IF

SEND ticketPrice TO DISPLAY
  • This is robust as:

    • The conditional loop prevents invalid ages from being accepted

    • The program only continues when the input is sensible

    • Validation protects the program from crashes and incorrect outputs

    • The solution handles user mistakes safely

Worked Example

A developer has implemented a program that accepts user input for a numerical score (between 1 and 100, inclusive). The code uses a running total algorithm inside a fixed loop to tally twenty scores, uses nested conditional statements to calculate a final grade (A, B, C, or D), and utilises meaningful identifiers for variables.

With reference to the required evaluation criteria, comment on the quality of the implemented solution:

Efficient use of coding constructs

[2]

Answer

  • Fixed loop to accept twenty scores is efficient, as it avoids the replication of code [1 mark]

  • Nested IF statements or ELSEIF structures to assign the final grade is efficient because it reduces the number of comparisons the program executes compared to using multiple separate IF statements [1 mark]

OR

  • 1-D arrays used to store the twenty scores, this is efficient compared to declaring multiple individual variables [1 mark]

Unlock more, it's free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Computer Science & English Subject Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.