Why programs are divided into modules
A self-contained part of a program that does one job, so it can be built, tested on its own, reused in other places and changed without breaking the rest of the solution.
Understanding Why programs are divided into modules in QCE Digital Solutions Unit 3
What it does: The one calculateGST module is called twice, so the code is written once and reused. Each call is a separate module with its own single job, so changing one does not break the others. A module should have one clear job. This keeps it easy to understand, test and change. Modules can be tested separately. You can check one small part works before joining it to the rest. Reusing one module avoids repeated code. If the rule changes, you fix it in only one place. A self-contained module can be changed without breaking the rest of the solution. A name that describes one job shows the module has a clear purpose. A name like doEverything suggests the module is doing too much.
Common mistakes: The module getTotal has one job: multiply the price by the quantity. Adding them gives the wrong result. It should be 'return price * qty'. Testing the module on its own with 18 should give true, but 'age > 18' gives false. The test exposes the boundary error. It should be 'return age >= 18'.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 194–250) and word search (Modules 194–337).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
moduleFill in the Blanks
Spot the Error
Student with a class code? Join your class →