24 lines
2.5 KiB
Markdown
24 lines
2.5 KiB
Markdown
---
|
|
name: Fittingness as the test for whether to refactor
|
|
description: When auditing code for elegance/simplification, the test is whether the current form already contains what is necessary and nothing more, nothing less. If yes, leave it. Don't refactor for the sake of refactoring.
|
|
type: feedback
|
|
originSessionId: 3bf7ae75-1138-4745-9024-0c40b3755ad3
|
|
---
|
|
Stated by steward 2026-05-06 in context of §XII SCSS Pass 1/Pass 2 audit, after I'd identified Pass 2 (flatten nesting) as a possible follow-up:
|
|
|
|
> *"It should be beautiful in the sense that it contains what is necessary and nothing more, nothing less. If the nested version is that already, then we don't need to touch it."*
|
|
|
|
**Why:** This is Bringhurst's *fittingness* (τὸ πρόσφορον) — and the global CLAUDE.md prime directive — applied as the editorial test for code review. The mistake is refactoring against an aesthetic preference (e.g., "flat is better than nested" in some abstract sense) rather than against the actual question: does each element of the current form earn its place?
|
|
|
|
The pattern this counters: *cosmetic refactor as virtue-signalling*. A change that reduces line count or nesting depth without removing redundancy or clarifying meaning is not an improvement; it is movement that costs review effort and risks regression for no actual gain.
|
|
|
|
**How to apply:**
|
|
- When auditing code for elegance, separate two distinct questions:
|
|
1. Are there redundancies, vestigial elements, or accreted history that can be cut? (If yes, cut them.)
|
|
2. Is the form's STRUCTURE — its nesting, grouping, ordering — the most fitting expression of what the rules actually do? (If yes, leave the structure alone, even if it could be expressed differently.)
|
|
- The first question is *cleaning*. The second is *judgement*. Don't conflate them.
|
|
- For nesting specifically: if each level of nesting is doing real structural work (expressing scope, context, or specificity), the nesting is earning its place. Flattening would just relocate the structural information into longer selectors without simplifying anything.
|
|
- Bringhurst-style precision: when in doubt, ask "what does this element say that nothing else does?" — if the answer is "nothing," it can be cut. If it carries meaning, it stays.
|
|
|
|
**Cross-reference:** §XII SCSS Pass 1 (commit f4716e6, 2026-05-06) cut 33% by removing redundancy. Pass 2's "flatten nesting" item was held back per this principle — the nesting was already fitting; flattening would have been cosmetic.
|