AI has limited context windows and little ability to reason about what complex code does.
If you can refactor it to small modules with simple interfaces and properly document the interfaces and what the modules do, AI can work with your code more easily. Think of the ideal AI codebase as being assembled from libraries (even if private internally developed ones) with a small amount of glue code in between.
Ah, getting AI to do that part of the work… hasn’t worked for me. The only thing that it’s been helpful for in that regard is as a rubber duck, which isn’t much. But honestly, the built-in refactoring tools in an IDE are more consistent.
How’s your test coverage? Good E2E tests that treat the codebase like a black box will help a lot, however you approach the actual refactoring. That might conceivably also be something the AI could help you with.
AI has limited context windows and little ability to reason about what complex code does.
If you can refactor it to small modules with simple interfaces and properly document the interfaces and what the modules do, AI can work with your code more easily. Think of the ideal AI codebase as being assembled from libraries (even if private internally developed ones) with a small amount of glue code in between.
This is exactly the thought I had. The challenge is starting with messy undocumented code that sprawls out all over the place.
How to you go from spaghetti code to nice neat modular code using AI?
Ah, getting AI to do that part of the work… hasn’t worked for me. The only thing that it’s been helpful for in that regard is as a rubber duck, which isn’t much. But honestly, the built-in refactoring tools in an IDE are more consistent.
How’s your test coverage? Good E2E tests that treat the codebase like a black box will help a lot, however you approach the actual refactoring. That might conceivably also be something the AI could help you with.
YAGNI https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
I would suggest to leave worrying about it when you it is actually on your plate.
Did you try running some ai over it to see if it is capable of being useful?
Legacy code is a statement but in the end it only matters if it works and is maintainable.
It might surprise you.
I got mixed results. A good portion of the code was written by former employees. There is little documentation.