note
eyepopslikeamosquito
<P>
<blockquote>
<I>
What one thinks will be a straightforward rewrite from the beginning
can change in focus and gain features before the rewrite is done.
</I>
</blockquote>
Yes, I suspect this happens rather a lot.
I once inherited an "unmaintainable" build system written as a huge DOS .BAT script.
Well, it was unmaintainable to me, because I didn't know .BAT very well and,
frankly, didn't want to. My strong opinion, expressed in [id://668481],
is that you should not write non-trivial systems in .BAT (or Unix shell).
Luckily, it was only a few thousand lines long and I was able to "rewrite"
it in Perl fairly painlessly.
Because the original design and interface was so bad, I "improved" it as I went,
so my "rewrite" ended up a fair bit different to the original.
Naturally, I didn't write it as a monolithic script, but as a number of modules
along with a small script mainline.
Now you and [BrowserUk] may claim I didn't rewrite it, I wrote a new build system.
Fair enough, but I prefer not to argue about that any more. :)
The important strategic question is:
should I have "rewritten" it in Perl or improved it by changing
the existing .BAT script?
From my (biased) point of view, the "rewrite" was a raging success because we
were able to extend this system many times over the years (often by adding
new modules) and I feel the cost of the rewrite was got back many times
over by improved robustness and performance, along with much easier maintenance
over a period of many years.
</P>
<P>
Of course, rewriting small systems is easy.
Suppose this system has now grown to 100,000+ lines of Perl and the
person who takes it over dislikes Perl, claims it is a tangled mess,
and decides it would be more "maintainable" to rewrite it in Ruby or Python.
Is that a wise decision?
Though I would normally argue against that,
<a href="http://avatraxiom.livejournal.com/58084.html?page=2">others have been known to argue for it</a> (BTW, as far as I'm aware, sanity prevailed and Bugzilla is still written in Perl).
</P>
<P>
Whether it makes sense to rewrite depends on many factors:
how large the system is; how ambitiously you want to extend it; how clean is its code; and how
skillful are the rewriters.
I make the last point because unfortunately I've seen a number of
over-confident programmers over the years complain loudly
about a crappy old system, boldy rewrite it ... then end up with
a crappier system than the original!
In my experience, the <I>quality</I> of the developers doing the rewrite
is crucial:
a creaky old legacy system written by first-rate developers is
likely to be better than a shiny new one rewritten by mediocre developers.
As
<a href="http://www.joelonsoftware.com/articles/fog0000000069.html">Joel Spolsky cautions when you rewrite</a>:
"there is absolutely no reason to believe that you are going to do a better job".
</P>
883757
885615