Skip to content

Comments only where the code cannot say it; explanations move to docs/ARCHITECTURE.md - #71

Merged
dinooo13 merged 1 commit into
mainfrom
t3code/comments-say-why
Oct 15, 2026
Merged

dinooo13 merged 1 commit into
mainfrom
t3code/comments-say-why

Conversation

@dinooo13

@dinooo13 dinooo13 commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #70. Comments went from 4,744 lines to 1,060. The design explanations moved into a new docs/ARCHITECTURE.md, and the code is unchanged apart from a handful of renames in their own commits.

Non-blank lines Comments before Comments after Code before Code after
Sources 4,147 1,010 10,007 10,007
Tests 597 50 5,843 5,843

The rule

A comment stays only when it says something the code cannot, and a reader would otherwise get it wrong. That is either a constraint from outside, a measured number with its source, or a trap that looks removable but isn't. Doc comments that restate a name go, as do narration, history, and repeats of CLAUDE.md. Where a comment only explained what something is, the fix is a better name. The rule is now in CLAUDE.md under "Code style", so the code doesn't drift back.

Kept on purpose:

How to review it

Comment-only commits (Core, System, Refine, Engines/Audio/Bench, CLI, App, Tests, and one more): each passes a checker that strips comments and whitespace from every Swift file before and after, and finds no code change. A second check compares every string literal, multi-line prompts included, file by file, because the first check can't see whitespace inside strings. It finds none changed. These commits can be skimmed.

Naming commits (2), checked by the build and all 558 tests:

  • HotkeyEvent.cancelled → .interrupted. That's the word the trackers already used, and it no longer reads like the Escape cancel key.
  • hotkeyOverride → standInHotkey, the name HotkeyRouter and HotkeyWarning already use.
  • The coordinator's recording counter → recordingID.
  • PasteWindow fields → pasteStart, pasteLength, fieldLengthAtPaste.
  • ClipboardKeeper.left → leftBehind.
  • The corrector's term → termIndex.

Three of these renames sit on the release-to-paste path, as renames only. Nothing persisted, logged or localised was renamed.

Docs commit: docs/ARCHITECTURE.md (389 lines) has these sections:

  • Modules
  • Dictation flow
  • Engine
  • Hotkeys
  • Paste and clipboard
  • Muting the speakers
  • Processors
  • Polish
  • Learned corrections
  • Settings file
  • The app
  • The overlay
  • pladder-cli

It links to the CLAUDE.md Decisions table, PERFORMANCE.md and BENCHMARKS.md rather than repeating them. Code points into it with one line where a reader needs it, and every pointer names a section that exists. README and CLAUDE.md link to it.

No benchmark: no code on the release path changed beyond the three renames.

Review fixes

The line counts in the table above are from before these commits. swift test: 590 tests by swift-testing's count, all passing; swift build and swift build -c release have no warnings in Sources/.

🤖 Generated with Claude Code

@dinooo13
dinooo13 force-pushed the t3code/comments-say-why branch from fc91aca to bc34d2b Compare October 9, 2026 17:39
@dinooo13
dinooo13 added this pull request to stack #72 October 9, 2026 17:40
@dinooo13
dinooo13 force-pushed the t3code/comments-say-why branch from bc34d2b to c31e32e Compare October 9, 2026 17:51
Base automatically changed from t3code/pladder-architecture-review to main October 15, 2026 17:36
…ove to docs/ARCHITECTURE.md (#71)

A comment stays for an outside constraint, a measured number or a trap; everything else is said by the code, a name, docs/ARCHITECTURE.md or CLAUDE.md. Apart from comments, whitespace and the renames the PR lists, the code is the one the architecture review (#70) landed. The PR's own history is on its original head, 9807051.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dinooo13
dinooo13 force-pushed the t3code/comments-say-why branch from 9807051 to 5333248 Compare October 15, 2026 17:40
@dinooo13
dinooo13 merged commit 69fe600 into main Oct 15, 2026
1 check passed
@dinooo13
dinooo13 deleted the t3code/comments-say-why branch October 15, 2026 17:44
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