Evaluation

The Evaluation phase is where the final product is compared to the requirements detailed in the analysis phase and if it can be declared as fit for purpose.

It is important to consider the following when creating code:

  • Has the programmer used repetition (loops) where possible to reduce the amount of code?
  • Has the programmer used arrays (lists) where possible instead of declaring many individual variables?
  • Has the programmer used selection statements that will only make comparisons until a solution if reached?
  • Has the programmer used subprograms if the program needs to repeat a process at different points?
  • Has the programmer selected the correct data type for each variable?

If the answer to all of the above is yes, then the programmer has created software that makes efficient use of constructs.

If the answer is no, then the programmer should be encouraged to go back to previous phases of development to make more efficient use of coding constructs.

Inefficient code:

number1 = int(input("Please enter a number: "))
number2 = int(input("Please enter a number: "))
number3 = int(input("Please enter a number: "))
number4 = int(input("Please enter a number: "))

if number1 > 20:
    if number1 < 40:
        print("Number 1 is in the correct range")
if number2 > 20:
    if number2 < 40:
        print("Number 2 is in the correct range")
if number3 > 20:
    if number3 < 40:
        print("Number 2 is in the correct range")
if number4 > 20:
    if number4 < 40:
        print("Number 3 is in the correct range")

Efficient code:

numbers_array = []
for counter in range(4):
    numbers_array.append(int(input("Please enter a number: ")))

    if numbers_array[counter] > 20 and numbers_array[counter] < 40:
       print("Number " + str(counter + 1) + " is in the correct range")
Report a Glow concern
Cookie policy  Privacy policy

Glow Blogs uses cookies to enhance your experience on our service. By using this service or closing this message you consent to our use of those cookies. Please read our Cookie Policy.