Hacker News new | ask | show | jobs
by metalspot 19 days ago
Rewriting while changing features is the worst idea ever, which almost always leads to failure, and is the reason why "don't do rewrites" is a widespread rule.

Whether it is humans or AI, the correct way to do it is always a feature exact rewrite, so you can do comparative testing on both systems, and progressive rollout, and then you start adapting features.

1 comments

Not sure I agree. Having a complete rewrite like you propose is a huge project, and a very scary flip. And I honestly don't see the value in doing it like that. So now you have the same mess as before, just re-written?

Best I've seen it done is to move module by module. So if you want to do "X", you now have to do it in the new system. And the big part of the rewrite of X is figuring out the specs and making it better along the way. Then people also actually want to move.

Moving module by module is definitely the safer way to do it, but at the module level you do the same thing. You have to have it feature exact so that you can replay test against the same interface and do progressive roll out. The difference with AI is that the module size you can one-shot goes way up compared to traditional human rewrite.

> same mess as before, just re-written

The likely path here is probably rewriting from node.js/ruby/python/etc to go/rust/c#/etc so a feature exact rewrite that passes all tests and can return identical responses for replayed production requests is not the same mess at all. You can do all sorts of refactoring, bug fixing, etc, while maintaining exact feature compatibility. The other major thing is back-filling exhaustive test coverage with AI, which then makes agentic coding much more accurate, because the feedback loop from failing tests provides the context for AI to self correct.

A test suite and code are two complimentary representations of the same logic, so using AI to grind test coverage to really high levels (90-95+) gives you two independent inference paths through a model, then the feedback signal from test failures gives you the mechanism to drive these two distinct generation paths to convergence.