A school wants an application that automatically generates the weekly timetable for all its classes. Explain how decomposition and abstraction could be used in the design of this application.
Show the markscheme
Markscheme (4 marks)
- Decomposition: breaking the system down into smaller sub-problems, e.g. entering data, generating the timetable, detecting clashes, displaying the timetable.
- Benefit of decomposition in this context: each module can be programmed/tested separately or developed by different members of the team.
- Abstraction: keeping only the relevant data, e.g. for each lesson the class, subject, teacher, room and time slot.
- Benefit/example of what is ignored: irrelevant data (the teacher’s age, the colour of the room) is discarded, which simplifies the model and the data to be stored.
A full-marks answer
Using decomposition, the problem of generating the timetable is broken down into sub-problems: managing the data (teachers, rooms, classes), allocating lessons to time slots, detecting clashes and displaying each student’s or teacher’s timetable. Each module can be programmed and tested separately, even by different people, and an error in clash detection can be located without reviewing the whole system.
Using abstraction, each lesson is represented only by the data needed for scheduling: class, subject, teacher, room and time slot; for teachers, only their availability and the subjects they teach are relevant. Details such as the teacher’s age or the decoration of the room are ignored because they do not affect the timetable; this makes the model simpler and reduces the amount of data stored.