Skip to content

L10 Call chains and trace boundaries

18 minSuggested first: L09 Tests and configuration

Outcome

Produce an ordered trace between an explicit start and stop, following the branch taken by the given input.

Learn

A direct call is one the current function makes itself. A transitive call happens further down the chain. The codebases index helps you find candidates, but a reported reference isn't proof that the call runs for this input.

Record the caller, the callee and your evidence, and stop exactly where the question says.

Worked example

Starting at serve(5), include the start and stop at the first entry to write. Which functions are entered, in order?

JavaScript
function serve(n) { return n > 0 ? pack(n) : empty(); }
function pack(n) { return write({ count: n }); }
function write(data) { return data.count; }
function empty() { return 0; }
Predict first, then show the worked explanation

5 > 0 is true, so serve calls pack, which calls write: the trace is serve → pack → write. The other branch, empty, isn't taken. Returning to serve afterwards isn't another entry to serve.

Practice and check

Guided practice

Practice, not scored

For serve(0), stop at the first helper entered. Which order is right?

Choose one answer

Exit check

Counts toward completion

For serve(5), which function directly calls write?

Choose one answer

Common mistake

Listing every name visible in the function. Use the input, follow the branch it takes, and apply the stop rule.

Practice on a real repository

Try one of the Trace puzzles below. Each Trace prompt defines which calls count and where the trace starts and ends; read those rules on each puzzle.

Related topics: Request lifecycle

Practice is optional. Solving a puzzle doesn't complete a lesson, and lessons never change a puzzle's points.

References