Exam-style question
Try this first
A programmer uses a function to obtain a result but does not need to know which computation method is used inside the function. Explain why this is an example of functional abstraction. Also explain what would be missing if the abstraction only produced a procedure.
Model answer
What a good answer should say
- It is functional abstraction because the programmer uses the result of the function without needing to know the particular computation method used to produce it.
- If the abstraction only produced a procedure, the result would be a procedure rather than a function, so the additional abstraction that disregards the particular computation method would be missing.
Explanation
Why this works
The answer should connect the user's independence from the implementation method with functional abstraction. It should also distinguish this from procedural abstraction, whose result is a procedure.
Common mistake
No common mistake is linked to this question yet.
