Skip to content

Reimplements a helper the project already has, under the same or another name ​

Code that already exists: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc gives every session the rule: take what is already in the codebase before new code.

What makes reimplementing a helper the project already has a bad practice? ​

The standards that call it a bad practice: DRY (Hunt & Thomas, The Pragmatic Programmer); Fowler, Refactoring: Duplicated Code; CWE-1041 Use of Redundant Code; Sonar S4144.

What does lessloc do about reimplementing a helper the project already has? ​

lessloc gives every session the rule: take what is already in the codebase before new code. Hints name existing code before the task and inside each subagent's prompt. lessloc catches it as copy, near-copy and similar-name.

  • copy (tier 1): A block of dupLines code lines that also exists elsewhere, or a function with the same body as another under other names.
  • near-copy (tier 2): A new function that is mostly the same code as an existing one.
  • similar-name (tier 2): A new function whose name looks like an existing one's.

The other patterns in Code that already exists:

Released under the Apache-2.0 license. · llms.txt