Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Turn a Repeated Mistake Into a Check

Description and use

Developers repeatedly copy database read patterns, creating 44 duplicated code blocks. Introducing a single generic Reader type and tooling checks eliminates duplication and prevents future mistakes.

Problem

Developers repeatedly copy generic database read patterns, creating 44 duplicated code blocks that differ only in error messages, leading to maintenance overhead and hidden bugs.

Outcome

Reduced code duplication from 44 instances to a single generic implementation, improving maintainability and preventing future mistakes.

Workflow

  • Audit code for duplicate read patterns
  • Identify existing generic Reader implementation
  • Refactor duplicated code to use Reader
  • Add tooling checks (linter, tests, blocking hooks) to enforce non‑duplication

Evidence

44 copies of four shapes of reading rows out of the database.

Source

The rule said "don't copy a generic".

Source

  • Record date: 2026-09-15T17:30:38.297Z