Programming and Software Development: Question 5

Syllabus 12.1, 12.2, 12.3

Structured AS 7 marks

A software house is building a system for a small boutique hotel to track the status of each of its rooms.

(a) The hotel manager is unsure exactly which room-status features will be useful in day-to-day practice, and wants to try out an early working version of the system and give feedback before more features are added. State which development life cycle model, waterfall or iterative development, is more appropriate for building this system, and give one reason for your choice. [2]

(b) The design team represents each room's status using a state-transition table, with states Vacant, Reserved, Occupied and NeedsCleaning. Part of the table is shown below, with three Next state entries left blank.

Current state Event Next state
Vacant Room reserved by a guest for a future date Reserved
Reserved Guest checks in Occupied
Reserved Guest cancels the reservation Vacant
Occupied Guest checks out .....
NeedsCleaning Housekeeping finishes cleaning the room .....
Vacant Guest checks in directly with no prior reservation .....

Copy and complete the table by stating the correct Next state for each of the three blank rows. [3]

(c) Two testers are testing a function IsLateCheckOut(ExpectedTime, ActualTime), which should return TRUE if ActualTime is later than ExpectedTime.

  • Tester 1 reads only the specification for IsLateCheckOut, then designs test times and checks that the TRUE/FALSE result returned matches what the specification says it should be, without ever looking at the function's own code.
  • Tester 2 reads the source code of IsLateCheckOut, then designs test times so that every branch of code inside the function is executed at least once during testing.

State which tester is using black-box testing and which is using white-box testing, and state one difference between black-box and white-box testing that this scenario illustrates. [2]

Show worked solution Hide worked solution

Worked solution

Part (a): Choosing a development life cycle model

The hotel manager wants to try out an early working version of the system and give feedback before more features are built. The requirements are not yet fully fixed, and will likely be refined once the manager has used a working version. [1 mark] for identifying this as the key requirement.

  • Iterative development builds the system in small increments, each one a working version that can be shown to the hotel manager for feedback, with later increments adding or adjusting features based on that feedback. This directly matches what the manager wants.
  • Waterfall requires each stage (analysis, design, implementation, testing) to be finished before the next stage starts, so no working version of the system exists until development is essentially complete. There is no opportunity to try out an early version and feed back into the design.

So iterative development is the more appropriate life cycle model here. [1 mark] for a valid reason (an iterative model delivers an early working version for feedback; waterfall does not).

Part (b): Completing the state-transition table

Each row describes one event that can happen while a room is in a given current state, and the resulting next state:

  • Occupied, event “Guest checks out”: the guest has left, but the room is not yet fit for a new guest, so the next state is NeedsCleaning, not Vacant directly.
  • NeedsCleaning, event “Housekeeping finishes cleaning the room”: once cleaning is complete, the room is ready for a new guest, so the next state is Vacant.
  • Vacant, event “Guest checks in directly with no prior reservation”: a walk-in guest moves straight into the room, so the next state is Occupied, exactly the same next state reached from Reserved when a guest with a booking checks in.
Current stateEventNext state
OccupiedGuest checks outNeedsCleaning
NeedsCleaningHousekeeping finishes cleaning the roomVacant
VacantGuest checks in directly with no prior reservationOccupied

[3 marks], [1] for each correct Next state (NeedsCleaning, Vacant, Occupied).

Part (c): Black-box testing vs white-box testing

Tester 1 works only from the specification of IsLateCheckOut. What result it should return for a given ExpectedTime and ActualTime, and never looks inside the function’s own code to choose test data or to judge whether a result is correct. Testing based purely on a specification, with no reference to the internal code, is black-box testing.

Tester 2 reads the source code of IsLateCheckOut and deliberately designs test times so that every branch inside the function actually runs during testing. Using knowledge of a program’s internal code structure to design test data is white-box testing. [1 mark] for correctly identifying both testers.

The key difference: black-box testing treats the function as a “black box” and checks only that its outputs match its specification, with no knowledge of how it is coded internally; white-box testing uses knowledge of the internal code structure to make sure test data exercises specific paths or branches through that code. [1 mark] for a valid difference along these lines.

Final answers

  • (a) Iterative development, since it delivers an early working version for the hotel manager to give feedback on, unlike waterfall.
  • (b) NeedsCleaning, Vacant, Occupied (in that row order).
  • (c) Tester 1 = black-box testing; Tester 2 = white-box testing; black-box uses only the specification and outputs, while white-box uses knowledge of the internal code to target specific branches.