2 ms·
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 pr
by apothegm 1y ago
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.
- tmaly 1y agoThis 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?
- apothegm 1y agoAh, 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.