I have always been skeptical of rewriting working code - porting code is no exception to this. However, with the advent of TDD and automated testing it is much more reasonable to rewrite and refactor code.
Does anyone know if there is a TDD tool that can be used for porting old code? Ideally you could do the following:
- Write up language agnostic unit tests for the old code that pass (or fail if you find bugs!).
- Run unit tests on your other code base that fail.
- Write code in your new language that passes the tests without looking at the old code.
The alternative would be to split step 1 into "Write up unit tests in language 1" and "Port unit tests to language 2", which significantly increases effort required and is difficult to justify if the old code base is going to stop being maintained after the port (that is, you don't get the benefit of continuous integration on this code base).
EDIT: It's worth noting this question on StackOverflow.