One thing I've started noticing while developing with AI code assistants is that faster development can sometimes hide a new problem — dead code.
A requirement comes in.
I use an AI coding assistant, generate the implementation, test it, and move on.
Then the requirement changes.
Instead of completely revisiting the previous implementation, we often modify the existing code to fit the new requirement. And that's where things can get messy.
Old functions, conditions, components, variables, and logic may no longer be needed — but they quietly stay in the codebase.
The same thing can happen with test cases.
A requirement changes, but the old test cases remain. They may still pass, but they're no longer relevant to the current behaviour.
AI makes this easier to overlook because we can generate and modify code so quickly.
So I've started treating requirement changes differently:
When a requirement changes, don't just ask AI to modify the existing code. Ask it to identify and remove everything that became obsolete.
And when the requirement is updated:
- Review the existing implementation.
- Remove unused code.
- Review related test cases.
- Remove obsolete tests.
- Add tests for the new behaviour.
- Run the full relevant test suite.
AI can help us write code faster.
But we still need to be responsible for what stays in the codebase.
The goal shouldn't be to generate more code.
The goal is to maintain only the code we actually need.
Tags
#AICoding #CodeAssistant #SoftwareDevelopment #CleanCode #DeadCode #Testing #DeveloperExperience #AI #CodeQuality

Top comments (0)