Terminology – Is There a Term for Reusing Code by Retyping It?

code-reuserefactoringterminology

I built a prototype ("one to throw away") a while ago, and I'm rebuilding it now as an alpha. My goodness, it's been worth it.

I reused some of the prototype code by copy-pasting then modifying it, but I've fallen into a pattern of looking at the prototype for guidance, but writing the new code from scratch. This doesn't take too long for me because I'm a pretty fast touch-typist.

Right now I'm rebuilding a complex function, and I'm actually reading it line-by-line and typing equivalent code into my alpha version. I find it's better than copy-paste-refactor because I get reacquainted with the logic, and I don't miss parts of the code when I'm reading it. Is there a name for this kind of reuse? Any authoritative commentary on its benefits/drawbacks?

Best Answer

IMHO the term that matches your activity best is just a rewrite.

This may sound trivial, but some commenters have already used that term, and if you search for the term here on PSE, you will find lots of postings dealing with the question when a rewrite is good or bad, or when you go better with refactoring (which is most times used in opposition to "rewriting" things). See, for example, here:

When is a BIG Rewrite the answer?