ASK HN: How to engineer a JavaScript to Python migration?
41–42 of 42 posts
Re: ASK HN: How to engineer a JavaScript to Python migration?
#42I did a reasonably big rewrite from JavaScript (Nashorn, long story) to Kotlin/JVM recently (with 60x speedup and elimination of huge variance in runtime). Keys to success in a larger scale translation: - don't redesign anything, do a port (see also, Typescript compiler to Go port) - leverage LLMs interactively: per chunk (e.g. function), copy the old code into a comment in the new code, then use LLM completion to qu…
> for every method / control flow ported, add tests that target the newly added code, validating it does the same as the old code Nice, and as a bonus you end up with a well tested system. Can't speak highly enough of data driven testing for this kind of system. Gives you such confidence. > When you notice an opportunity to refactor, create a bug for it. Did you have success in getting time to revisit all these bugs?…
There was pressure from a reviewer in one area where the code could obviously be improved and I pushed back fairly hard in principle, but this was our first big project together and we were building trust, so I compromised in some leaf functions that presented the same API.