In the past month I’ve opened 2 PRs that deleted 2 confusing features my team was fighting against. In total it was about 1,400 lines of code. It turns out both of these features were completely dead code and the battle was in vain. An LLM was no use in finding out that the code was dead. It led all of us down confusing paths, spinning tales about what work we needed to do to support these features. But once I realized the code was dead, I could prompt an agent to help me clean up the code.
Pre-LLM, one of the more tedious parts of deleting code is finding all of the code that can be deleted after each round of deletion is through. I delete some code, now I need to go find all of the code that was only used by the deleted code, delete it, recurse. I found prompting an agent to help with this dramatically sped up the process.
I’m not positive why I trust an LLM to find all related dead code when it couldn’t even tell me the code was dead in the first place. But I have a sense (and some double-checking told me) that it seemed to be doing a good enough job.
Best case is that dead code isn’t left lingering around codebases. And LLMs struggle to find it (as far as I can tell). But once a human identifies it, an LLM is pretty decent at cleaning up the mess. About the least it can do with all of the verbose brain-dead code it seems to create.