Back to feed
Dev.to
Dev.to
6/16/2026
AI misses elegant code patterns

AI misses elegant code patterns

Original: The Code AI Won't Write

Short summary

The author tests a form validation problem against Claude, ChatGPT, and Gemini, revealing all three independently choose schema-driven solutions. Yet a composition-based approach—splitting address validators into separate functions—better handles missing keys and scales more elegantly. The insight: understanding why AI chose a pattern matters as much as understanding when humans would choose differently.

  • All three major AIs (Claude, ChatGPT, Gemini) independently converged on schema-driven validation
  • Composition-based validation (separate functions per type) is often superior for fixed domain structures
  • Understanding AI's reasoning patterns is valuable for product and engineering decisions

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more