Solution Evaluation Metrics (SQA National 5 Computing Science): Revision Note
Exam code: X816 75
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 + num4This 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 FORThis 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 DISPLAYThis 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 DISPLAYThis 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
ELSEIFstructures to assign the final grade is efficient because it reduces the number of comparisons the program executes compared to using multiple separateIFstatements [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!
Was this revision note helpful?