Use of Stubs and Flags

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Anthony Zeater

Use of Stubs and Flags


Drivers

Due to the bottom-up method of development I have employed in the creation of my software solution,
stubs are not used very much if at all, as they simulate the lower level modules to test higher modules,
whilst I am creating lower level modules and need the higher level modules to be simulated. As such I
have extensively used drivers to allow access to the lower level modules.

This first driver I have used simulates the user inputting a new
entry in the database for equipment or rooms. The user
selects the type as well as inputs the name of the
equipment/room and submits it. It is used in order to allow
access to the module which inserts new entries for equipment
and rooms into the database.

Figure 1 Addition of Items to the Booking Database

The other drivers I have used have been to allow the


execution of actually booking a room and a piece of equipment, with a driver dedicated to each. These
allow for the lower modules of actually inputting a session in the database as well as checking that items
have not been double booked.

Figure 2 Booking of Equipment Figure 3 Booking of Rooms


Anthony Zeater

Flags

Flags are variables (usually Boolean) which show that a certain condition has been met. Throughout my
software design major work, I have used flags in critical points in order to determine certain events
within the project as initiated by the user. For example, a key flag used within the booking system is the
“$loggedin” flag. This variable is set to true or false depending on whether the user is logged in or not.

Figure 4 Highlighted code is the $loggedin flag within header.php

This variable is used throughout the system to determine what pages are shown when the website is
accessed. If $loggedin is false, the user cannot access the bookings features of the website.

I have also used flags within the bookings system itself in order to check whether or not a user has
picked up, as well as returned a piece of equipment that they have booked.

Figure 5 Mysql database showing the use of pickupCheck and returnCheck flags
Anthony Zeater

The names of the flags are pickupCheck and returnCheck, storing a 1 if the item has been picked up and
returned respectively and a 0 if not. If an item has been picked up and not returned, the user cannot
delete their booking as this would allow them to get away with stealing the piece of equipment.

You might also like