in reply to
Re^3: Nobody Expects the Agile Imposition (Part VI): Architecture
in thread Nobody Expects the Agile Imposition (Part VI): Architecture
What one thinks will be a straightforward rewrite from the beginning
can change in focus and gain features before the rewrite is done.
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 Unix shell versus Perl
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.
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,
others have been known to argue for it (BTW, as far as I'm aware, sanity prevailed and Bugzilla is still written in Perl).
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 quality of the developers doing the rewrite
a creaky old legacy system written by first-rate developers is
likely to be better than a shiny new one rewritten by mediocre developers.
Joel Spolsky warns when you rewrite:
"there is absolutely no reason to believe that you are going to do a better job".