Rename split-loop-with-lambda to slice-with-lambda

The refactoring is now published as Slice on sammancoaching.org:
https://sammancoaching.org/refactorings/slice.html

- git mv ideas/split-loop-with-lambda -> ideas/slice-with-lambda
- rename learning-hour file and update frontmatter name
- update paths in tools/rehearse scripts and report title
- update prose: 'Split Loop with Lambda' -> 'Slice with Lambda'
  in learning hour, exercise READMEs, storyboard, solution comments
- link the published Slice refactoring from the pattern draft
This commit is contained in:
Your Name
2026-09-29 15:47:30 +00:00
parent 125bb7ad01
commit 77ae05c28c
114 changed files with 21 additions and 20 deletions
@@ -0,0 +1,40 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 460" font-family="Helvetica, Arial, sans-serif">
<defs>
<marker id="arrR" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M0,0 L10,5 L0,10 z" fill="#dc2626"/>
</marker>
</defs>
<rect width="760" height="460" fill="#ffffff"/>
<text x="24" y="34" font-size="20" font-weight="bold" fill="#0f172a">Anti-pattern — the drift: scorer left behind in the extracted method</text>
<text x="24" y="56" font-size="13" fill="#dc2626" font-weight="bold">Lambda-ize only the value-producing call, and the dependency travels with the extraction.</text>
<text x="24" y="74" font-size="13" fill="#dc2626" font-weight="bold">Happened in 2 of 6 agent rehearsal runs — behaviour passed, design goal silently failed.</text>
<!-- drifted extracted method -->
<rect x="250" y="110" width="300" height="190" rx="10" fill="#f8fafc" stroke="#64748b" stroke-width="1.5"/>
<text x="266" y="134" font-size="12" font-weight="bold" fill="#0f172a">collectExpectedWeather(<tspan fill="#9333ea">λ</tspan>)</text>
<text x="516" y="136" font-size="22" font-weight="bold" fill="#dc2626">✗</text>
<rect x="266" y="148" width="268" height="110" rx="8" fill="#eef2ff" stroke="#818cf8"/>
<text x="280" y="172" font-size="11" font-family="Menlo, Consolas, monospace" fill="#1e1b4b">for (Instant d : DATES)</text>
<text x="280" y="196" font-size="11" font-family="Menlo, Consolas, monospace" font-weight="bold" fill="#dc2626">scorer.updateSelection(); ✗</text>
<text x="280" y="218" font-size="11" font-family="Menlo, Consolas, monospace" fill="#1e1b4b">daysForward = between(ANCHOR, d)</text>
<text x="280" y="240" font-size="11" font-family="Menlo, Consolas, monospace" fill="#1e1b4b">expected.add(<tspan fill="#9333ea" font-weight="bold">λ</tspan>.apply(daysForward))</text>
<text x="266" y="284" font-size="10" fill="#dc2626">not static anymore — it uses the field</text>
<!-- scorer, still wired in -->
<rect x="600" y="140" width="130" height="56" rx="8" fill="#fef2f2" stroke="#dc2626" stroke-width="1.5"/>
<text x="665" y="162" font-size="12" font-weight="bold" fill="#dc2626" text-anchor="middle">Scorer</text>
<text x="665" y="182" font-size="10" fill="#7f1d1d" text-anchor="middle">still wired in</text>
<line x1="552" y1="192" x2="594" y2="172" stroke="#dc2626" stroke-width="1.5" marker-end="url(#arrR)"/>
<!-- what it breaks -->
<text x="250" y="330" font-size="12" fill="#475569">Behaviour looks fine (the test can still pass) — but the split is cosmetic:</text>
<text x="250" y="350" font-size="12" fill="#475569">step 4, moving the method to a class without Scorer, is now blocked.</text>
<!-- catch it -->
<rect x="250" y="374" width="310" height="72" rx="8" fill="#fffbeb" stroke="#d97706" stroke-width="1.5"/>
<text x="266" y="398" font-size="11" font-weight="bold" fill="#92400e">Catch it mechanically:</text>
<text x="266" y="418" font-size="11" fill="#92400e">• grep scorer on the extracted method → no hits</text>
<text x="266" y="436" font-size="11" fill="#92400e">• try static → won't compile with a field ref</text>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB