Skip to content

fix: correct Legacy Code examples, a curriculum link, and the index page title - #56

Merged
megabyde merged 2 commits into
mainfrom
fix/legacy-code-examples
Aug 17, 2026
Merged

fix: correct Legacy Code examples, a curriculum link, and the index page title#56
megabyde merged 2 commits into
mainfrom
fix/legacy-code-examples

Conversation

@megabyde

@megabyde megabyde commented Aug 16, 2026

Copy link
Copy Markdown
Member

Third of three stacked PRs, replacing #53. #54 and #55 are merged, so this targets main directly.

Two commits. The first corrects what the Legacy Code decks teach; the second silences a pandoc warning in the index build. Squash-merging collapses them, so the title above covers both.

8cbc205 — what the decks teach

Wrap Class demonstrated inheritance, not wrapping

05-safe-changes.md illustrated the Wrap Class technique with class LoggingEngine(Engine) calling super().calculate_torque(...). That is subclassing. The wrapper now holds an injected Engine and delegates to it, and the comparison table row that described the technique's location of change as Subclass is corrected to Wrapper.

The sprouting kata asked for something sprouting cannot do

06-kata-sprouting-wrapping.md instructed readers to add new authentication logic and "do not modify the original method". Sprouting requires a minimal change at the call site, so the task as written was unsatisfiable. Reworded to ask for exactly that minimal change, and the corresponding testing task now refers to the original entry point rather than a "legacy method" that no longer exists as described.

The invoice characterization test expected the wrong number

03-safety-net.md asserted Approx(1850.95). Walking the calculator shown on the same slide over its three line items gives 500, then 1368, then 2132.1. Corrected to Approx(2132.10).

The tax characterization test was a tautology

The Python example built a results dict by calling calc.calculate_tax(*case), then asserted that calc.calculate_tax(*case) equalled it. That passes for any implementation, including a broken one, which is the opposite of the lesson on the slide. It now records the six expected outputs directly. All six were checked against the TaxCalculator shown above them: NY 30k -> 1200, NY 60k -> 3600, NY 120k -> 10800, CA 50k -> 1500, CA 80k -> 5600, TX 45k -> 450.

null in C++

02-kata-identifying.md compared a pointer against null in the singleton example. Now nullptr.

Curriculum link

The Advanced TDD row 4 C++ Mars Rover link pointed at mars-rover-python-kata. Row 5 already had it right, so the two rows disagreed.

7b3d53d — pandoc title metadata

index.template.html hardcoded the <title> element, so pandoc saw no title metadata and warned on every build:

[WARNING] This document format requires a nonempty <title> element.
  Defaulting to 'README' as the title.

The page was always correct; pandoc just had no way to know. The title now comes from --metadata title="Clean Code Slides" and the template reads $pagetitle$, so there is one source for it. Generated output is byte-identical to before.

Wrap Class demonstrated inheritance rather than wrapping. Hold the legacy
Engine in the wrapper and delegate to it, and correct the comparison table
row that described the technique as subclassing.

The sprouting kata told readers not to modify the original method, which
sprouting cannot satisfy; ask for the minimal call site change instead.

The C++ singleton compared a pointer against `null`. The invoice
characterization test expected 1850.95 where the shown calculator returns
2132.10. The tax characterization test asserted against values it had just
computed from the same calculator, which passes whatever the behaviour is;
record the expected outputs instead.

Point the Advanced TDD C++ Mars Rover link at the C++ repository.
@megabyde
megabyde force-pushed the fix/legacy-code-examples branch from 7d058be to 8cbc205 Compare August 16, 2026 07:16
The template hardcoded the title element, so pandoc saw no title metadata
and warned on every build while defaulting to the source filename. Pass
the title as metadata and read it in the template.
@megabyde megabyde changed the title fix: correct Legacy Code examples and curriculum links fix: correct Legacy Code examples, a curriculum link, and the index page title Aug 16, 2026
@megabyde
megabyde merged commit 68e690b into main Aug 17, 2026
3 checks passed
@megabyde
megabyde deleted the fix/legacy-code-examples branch August 17, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant