Slides badge

Evaluation

Learning Intentions

  • Describe and exemplify evaluation of a solution in terms of: fitness for purpose, efficiency, robustness and readability.

Success Criteria

  • I am able to describe the terms: fitness for purpose, efficiency, robustness and readability and how these relate to software development

Fitness for purpose

  • Fitness for purpose is how well a program fulfils it original functional requirements. 
  • The functional requirements were agreed at the analysis stage by both the developer and the client. 
  • If any of these requirements are not met, the software is considered to not be fit-for-purpose.

A program is written to take in 20 numbers. It must then ensure that the numbers are between 0 and 100 (inclusive). The program then displays the average of these numbers. The program is written as below. Is this program fit-for-purpose or not and why?

Try it yourself

total = 0

for i in range(20):
  print("Please insert number", (i + 1))
  n = int(input())
  total = total + n

average = total / 20

A program is written to take in 20 numbers. It must then ensure that the numbers are between 0 and 100 (inclusive). The program then displays the average of these numbers. The program is written as below. Is this program fit-for-purpose or not and why?

Try it yourself

total = 0

for i in range(20):
  print("Please insert number", (i + 1))
  n = int(input())
  total = total + n

average = total / 20

Efficiency

  • Efficiency is, without any doubt, the most crucial component of large-scale software development.
  • Any software that is inefficient needs improved to improve efficiency and ensure that the software doesn't waste time and resources.
  • Think about something like Windows where time is very important.
  • Think about when you use Python. Do you want a loop to take as little time to complete or as much time as possible?

Efficiency

  • Inefficiency can normally be outlined as:
    • Not using loops to repeat something over and over again
    • Where an algorithm such as a running total could be used to make the code easier to implement
    • Using a fixed loop where a conditional loop may have been better
    • Not using an array where appropriate

Inefficiency examples

number1 = int(input())
number2 = int(input())
number3 = int(input())
number4 = int(input())
number5 = int(input())

total = number1 + number2 + number3 + number4 + number5
print(total)

Using an array 

Using a loop

Using predefined functions

This can be made more efficient by:

Using a conditional loop

Using a fixed loop

Inefficiency examples

print(0)
print(2)
print(4)
print(6)
print(8)
print(10)

Using an array 

Using a loop

Using predefined functions

This can be made more efficient by:

Using a conditional loop

Using a fixed loop

Inefficiency examples

for i in range(0, 30):
  print("Please insert a number")
  if n > 50:
    print("You gave me a number > 50")
    break

Using an array 

Using a loop

Using predefined functions

This can be made more efficient by:

Using a conditional loop

Using a fixed loop

Robustness

  • Robustness is another way of evaluating software.
  • A robust program should be able to cope with errors (or exceptions) during runtime.
  • Input validation allows us to check that the value the user has inserted is within the range and is also valid.
  • For example, imagine a program that takes in two numbers. The user then types their name for the first number. What would happen as a result of this?

Other ways of dealing with exceptions

  • Try and Except can be used to deal with exceptional data too. 
  • Whilst it is beyond the scope of the National 5 course, it is useful to know that the industrial standard of using try and except to stop errors (exceptions) interfering with the running of the program. 
try:
  x = int(input())
  print(x + 5)
except:
  print("Cannot add the numbers together. Are you sure you provided an integer?")

Readability

  • Readability is all about how easy the code is to understand.
  • There are four ways discussed at National 5:
    • Comments
    • Meaningful identifiers
    • Indentation
    • White space

Comments

  • Comments are something you should all be doing at National 5.
  • The most important comment that should be in every program that you write is the first comment which describes what the program does.
  • To comment your code you use the # sign at the start of a comment.
#Program to calculate the average
#Written by J Balfour 2020

Meaningful identifiers

  • Identifiers are names given to variables and functions (both known as first-class citizens)
  • A meaningful identifier is one that describes the purpose of it within it's name. 
  • You can use underscore case or camelCase when you are writing variable names or subprogram names (at least, in Higher, that is)
  • Variable names and subprogram names cannot be keywords in Python.
def john:
  alice = 10
  bob = 20
  
  zelda = alice + bob
  return zelda

iNDENTATION

  • Indentation is used to show the structure of a program. 
  • Python enforces indentation and is one of the only languages to do this. 
  • When you write an if statement, you'll notice the lines after are indented. 





if c > 10:
  print("This line is indented")

Lookup the rules for identifiers in Python. For example, can they start with underscores?

Task

White space

  • White space is another way of making code more readable. 
  • White space involves creating sections of the code with no content. For example, spacing out lines by adding a blank line after each line.
  • White space is employed in website design to make a website more readable, too.

Answer the questions on software evaluation

Task

Past Paper Questions

Try out the following past paper questions:

 

  1. 2018 Question 21(b)(ii)
  2. 2021 Question 12(c)
  3. 2022 Question 8(c)(iii)
Presentation Overview
Close
JB
National 5 Computer Science :: Software Design and Development :: Evaluation
© J Balfour
13:31 | 07-06-2023
Slideshow Outline
Save progress Show presenter mode Toggle whiteboard
Dark Mode Bold Text Accessibility
Random Number Generator Timer Binary & decimal converter Show Python editor Show Knox 90
Provide feedback Help
Login
Keywords
    Sections
      Binary conversion
      Denary to binary conversion
      Binary to denary conversion
      Feedback 👍
      Accessibility

      Apply a filter:

      ×
      All slide files