C20 · Topic 3.2 · 40 minutes · AAP-1.C, AAP-1.D
Explaining list abstraction
By the end you can:
- Compare generic traversal with separate variables.
- Give a concrete complexity-management explanation.
- Avoid claims that abstraction removes all testing.
Before this lesson: topics 3.1.
- List
- An ordered collection of elements referenced as one value.
- Data abstraction
- Representing a collection so code can use it without naming a separate variable for each element.
Understand
A generic traversal can apply one operation to every element of a list regardless of its length. With separate variables, a calculation that explicitly names each one needs new terms or statements as the collection grows. Explain this concrete code change rather than saying only that a list is easier or shorter.
An abstraction manages complexity but does not guarantee correctness or an efficient solution. The traversal can still have a wrong boundary, lost accumulator or early return. Show what the collection enables, then test the actual algorithm and its empty, repeated and boundary cases.
Worked example
A club catalogue grows from 5 to 45 capacities; the same inclusive filter is used.
- Append the 40 new values to the data collection.
- The FOR EACH traversal still applies the condition once to every element.
- A separate-variable version needs 40 new variables and edits to code that explicitly names all capacities.
Explore each concept
Choose a concept, change its inputs and follow the explanation. Each example models the stated rule or scenario; completing it is practice rather than evidence of mastery.
- List order and duplicates
- Generic traversal versus separate variables
- Preserving associations
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Collection size (0–8)3Waiting
- RepresentationlistWaiting
Ready to explore: Grow a collection without rewriting the algorithm
Why: Change an input, predict the first effect, then advance one step.
Try this: Change one input or choose another listed case. Predict the effect, reset and compare the states and governing rule.
Step through and experiment
Change it · step through · explain
Change an input, predict what will happen, then advance one step. Read why the state changes, reset and experiment. This fixed teaching model does not save progress or award XP.
Ready · Make a prediction
- Input 12,7,3,7,0Waiting
- Input 25Waiting
Ready to experiment
Why: Predict the first change, then advance one step.
Try this: Try repeated boundary values, no matches and an empty list.
Check a misconception
Claim: Using a list means no code can ever need changing.
The generic traversal need not change just for list length, but new requirements and defects can still require code changes.
Guided practice
Explain the list’s benefit using this exact growth example.
Work with a partner. Make a prediction, compare your reasoning, then identify the rule that supports your answer.
Independent transfer
A student says “lists make every programme faster”. Evaluate the claim.
Exit check
What evidence is missing from “I used a list, so complexity is managed”?
Write your reasoning before comparing with a classmate. If your teacher assigned this task, submit it through My classes to save your work and receive feedback.
Check yourself
Your practice so far
Check an answer to see its rationale.