Files
learning-hour-maker/ideas/split-loop-with-lambda/storyboard/svg/05-debrief-dead-call.svg
T
Your Name 231f6aa72f Add storyboard handout for split-loop-with-lambda mechanics
Step-by-step refactoring instructions as a single markdown handout with
one diagram per step (legend + steps 0-3, overload inset, pure test,
debrief slides for the dead call and the drift anti-pattern). Derived
from the pattern draft, the learning hour plan, and the rehearsal
findings; slide-ready for later.
2026-09-27 18:04:33 +00:00

25 lines
2.0 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 460" font-family="Helvetica, Arial, sans-serif">
<rect width="760" height="460" fill="#ffffff"/>
<text x="24" y="34" font-size="20" font-weight="bold" fill="#0f172a">Debrief — the lambda made dead code visible</text>
<text x="24" y="56" font-size="13" fill="#475569">updateSelection() re-rolls Scorer.flavour — state nothing in this method ever reads. Delete it; the approved file is unchanged.</text>
<!-- lambda box -->
<rect x="200" y="110" width="360" height="124" rx="10" fill="#faf5ff" stroke="#9333ea" stroke-width="1.5"/>
<text x="216" y="136" font-size="11" font-family="Menlo, Consolas, monospace" font-weight="bold" fill="#9333ea">daysForward -&gt; {</text>
<text x="216" y="162" font-size="11" font-family="Menlo, Consolas, monospace" fill="#dc2626">scorer.updateSelection();</text>
<line x1="216" y1="157" x2="408" y2="157" stroke="#dc2626" stroke-width="1.5"/>
<text x="420" y="162" font-size="10" font-weight="bold" fill="#dc2626">✗ delete me</text>
<text x="216" y="188" font-size="11" font-family="Menlo, Consolas, monospace" fill="#1e1b4b">return scorer.lookupWeather(daysForward);</text>
<text x="216" y="212" font-size="11" font-family="Menlo, Consolas, monospace" font-weight="bold" fill="#9333ea">}</text>
<!-- result -->
<text x="200" y="290" font-size="13" font-weight="bold" fill="#16a34a">✓ approved file unchanged:</text>
<text x="200" y="316" font-size="13" font-family="Menlo, Consolas, monospace" fill="#166534">{Strawberry:12, Chocolate:12, Vanilla:17, }</text>
<!-- explanation -->
<rect x="200" y="350" width="360" height="72" rx="8" fill="#f8fafc" stroke="#94a3b8" stroke-width="1"/>
<text x="216" y="374" font-size="11" fill="#334155">Why: Scorer.flavour's only real consumer is the unrelated</text>
<text x="216" y="392" font-size="11" fill="#334155">salesForecast(). In the long-range loop it was copy-paste</text>
<text x="216" y="410" font-size="11" fill="#334155">residue — visible only once the lambda made it explicit.</text>
</svg>