Modularity, Scope and Interfaces
Structuring programs into cohesive modules, procedures, functions and classes with clear parameters, return values, scope and documented interfaces.
How to study A-level Computer Science
Define the problem and representation, trace the state change, justify the algorithm or architecture, then test the result against requirements, evidence and constraints.
Core concepts
Concept 1
Modularity controls complexity by grouping related state and behaviour behind a defined interface.
Exam cue: State the module's single responsibility before defining its public operations.
Concept 2
Parameters and return values make data flow explicit; local scope reduces unintended coupling.
Exam cue: Prefer parameters and return values to hidden dependence on global state.
Concept 3
Cohesion, coupling, information hiding and reusable components affect maintainability and testing.
Exam cue: Test a component at its interface before integrating it with the wider system.
Risk pitfalls and guardrails
Splitting code into many procedures that still share uncontrolled global state.
Guardrail: Do not substitute a memorised definition or generic advantage until you have identified the input, state, stakeholder and constraint in the task.
Confusing a parameter definition with an argument supplied in a call.
Guardrail: Do not substitute a memorised definition or generic advantage until you have identified the input, state, stakeholder and constraint in the task.
Exposing internal representation when only an operation needs to be public.
Guardrail: Do not substitute a memorised definition or generic advantage until you have identified the input, state, stakeholder and constraint in the task.
Memory anchors
Module
A module groups related code and data behind a defined interface.
Parameter
A parameter names input received by a procedure or function.
Return Value
A return value carries a result back to the caller.
Scope
Scope defines where an identifier is visible and usable.
Cohesion and Coupling
Aim for high cohesion within modules and low coupling between them.
Checkpoint rule
Do the check-up only after you can summarize each concept in one sentence and identify one dangerous pitfall from memory.
Knowledge Check (after reading)
Short check-up to confirm understanding of this module.
Check-up Questions
What is the main advantage of a pure function?
What is the scope of a local variable declared inside a subroutine?
Answer all questions to submit.
Next step personalized recommendations
Continue learning
Move forward only after this module is stable.
What is Pass Harbor?
Completely free exam prep for 247 UK exams.
- Practice questions
- Flashcards
- Study guides
- Mock exams
- No registration
- No paywall
- Start instantly
“No more expensive exam prep. Quality study tools should be accessible to everyone.”
