docs: exempt deliberate boundaries from the second-caller rule

As written, the bullet banned any interface with a single implementation,
which contradicts the Repository Pattern in rules/common/patterns.md: it
requires business logic to depend on an abstract repository interface,
and a project backed by one database has exactly one implementation.

Scope the rule to speculative abstractions and name the exemption, so the
two files in rules/common/ no longer give opposite instructions.
This commit is contained in:
AlexisLeDain committed 2026-11-04 09:42:54 +01:00
1 parent 1cf547bfd7
commit 676f3f3daf
1 file changed
+5 -3
+5 -3
View File
@@ -31,9 +31,11 @@ Rationale: Immutable data prevents hidden side effects, makes debugging easier,
- Do not build features or abstractions before they are needed
- Avoid speculative generality
- Start simple, then refactor when the pressure is real
- No abstraction before the second caller: no interface with a single
implementation, no factory for one product, no config option for a value
that never varies
- No speculative abstraction before the second caller: no interface extracted
from a single implementation, no factory for one product, no config option
for a value that never varies. A deliberate boundary is not speculative: a
repository interface that isolates business logic from storage (see
`patterns.md`) earns its place at the first implementation
## File Organization