# Keeps old and new versions side by side (`parse_date_v2`, `fooFixed`, `legacyFoo`, `app_new.py`)

*Code that already exists*: one of the ways AI coding agents bloat software, from lessloc's [pattern catalog](https://lessloc.org/patterns/index.md). lessloc gives every session the rule: one implementation per rule.

## What makes keeping old and new versions side by side a bad practice?

The standards that call it a bad practice: DRY; Clean Code G9 Dead Code.

## What does lessloc do about keeping old and new versions side by side?

lessloc gives every session the rule: one implementation per rule. lessloc catches it as [`versioned-copy`](https://lessloc.org/guide/reference.md#tier-1), and as [`junk-file`](https://lessloc.org/guide/reference.md#tier-0) for files.

- `versioned-copy` (tier 1): A definition beside an older version of itself, such as `parse_date_v2` next to `parse_date`.
- `junk-file` (tier 0): A new backup, copy, scratch or report file (refused before it lands, unless the request names it), or cache files, build output or logs that would be committed.

## Related patterns

The other patterns in [Code that already exists](https://lessloc.org/patterns/index.md#code-that-already-exists):

- [Reimplementing a helper the project already has](https://lessloc.org/patterns/reuse-helper.md): lessloc gives every session the rule: take what is already in the codebase before new code.
- [Copying a rule another function owns](https://lessloc.org/patterns/copied-rule.md): lessloc catches it as `repeated-literal`.
- [Rebuilding what the standard library or framework has](https://lessloc.org/patterns/rebuilt-library.md): lessloc gives every session a rule against it and catches it as `simpler` and `reinvented`.
- [Copy-pasted test cases instead of one parametrized test](https://lessloc.org/patterns/copied-tests.md): lessloc catches it as `copied-tests`.
- [A second library for a job an installed one already does](https://lessloc.org/patterns/second-library.md): `new-dependency` names the library that is already installed.
- [The same data shape in several layers (DTO, model, entity)](https://lessloc.org/patterns/duplicate-shapes.md): `copy` catches identical type bodies.
- [The same CSS declarations under another selector](https://lessloc.org/patterns/css-copy.md): lessloc catches it as `style-copy`.
