I Know These Design Flaws All Too Well
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
An experienced developer tests Claude Code (Sonnet and Opus models) on implementing a money transfer domain model with a finite state machine, critiquing the AI-generated code for classic design flaws: primitive obsession, enum-based state machines, nullable fields hiding multiple types in one class, and defensive exception-throwing code. By iteratively refining prompts — instructing Claude to make invalid states unrepresentable and write less verbose code — the output improves significantly but never fully reaches production quality. The author concludes that Claude is better at analyzing and scaffolding infrastructure code than synthesizing clean domain models, and personally continues to write core domain models by hand while delegating everything else to Claude.
Sort: