Can AI help me tame legacy codebases?
With the development of AI and the rise of ChatGPT, this is a relevant question to ask. Sure, it can generate new code you have to maintain. But can it help you maintain existing code?
- ChatGPT & Copilot are NOT Refactoring Tools is a short explanation from Emily Bache on why AI is technically not a refactoring tool.
There are many tools popping up around, here are some I want to highlight:
- CodiumAI can help you generate tests on existing code. I gave them a hand on the VS Code extension in early 2023.
- Rubberduck for VS Code. I also contributed to this one. It's an open-source extension that can be an helpful assistant.
- Denigma which seems to be really good at explaining what spaghetti code is doing.
Here are interesting studies related to the usage of AI to deal with existing codebases:
- Refactoring vs. Refuctoring by CodeScene. They figured that LLMs will generally introduce a regression when attempting to refactor complex code. But coupled to a fact-checking validation step, tooling could leverage these and only suggest the ones that actually work. This is promising because it would unlock more powerful automated refactorings.
- Can It Edit? Evaluating the Ability of Large Language Models to Follow Code Editing Instructions.This one concludes that it's a good idea to train models on the codebase commits. Also, closed and distilled models seem to be doing a better job than open ones. Finally, the more specific the instructions, the better.
🎓 Related articles
- Can AI help me refactor legacy code?
Can assistants like ChatGPT refactor existing code without introducing bugs? Let's figure it out with an actual codebase.
- Can AI help me write tests on legacy code?
People are using tools like ChatGPT to write tests on existing code… But how reliable is this? Let's find out!
- Can AI-based test generation help you test Legacy Code?
I experimented with tools that can generate tests for you, leveraging AI. Here is what I learned, along with some thoughts about testing unfamiliar code…