
Things You Should Never Do, Part I - Jakob
http://www.joelonsoftware.com/articles/fog0000000069.html
======
jasongullickson
This argument (don't re-write) sounds great to laymen and managers because
they see "the code" as the sole artifact of the development effort. The flaw
here (known to almost any developer) is that the code itself, the physical
files and such represents the work of developing an application as completely
as a photograph of a boxing match represents boxing itself.

Evidence of this can be seen in the many examples of companies "buying out" an
application by taking only the source and attempting to run with it. The
results are rarely, if ever, spectacular.

Most of the application is in the minds of the developers. Take away his
source and ask a developer to re-write an application and you are guaranteed
to get a better program. Why? Because by the end of the project you know more
than you did at the beginning, and when you re-write the code from scratch you
can leverage this knowledge on all of the code, not just the code you wrote
after you learned these lessons.

In this way it is impossible to re-write something (unless you are starting
with new developers as well), just like if you asked Stephen King to re-write
(as in, re-type) The Shining...

~~~
tapostrophemo
"Most of the application is in the minds of the developers. Take away his
source and ask a developer to re-write an application and you are guaranteed
to get a better program."

Well, not always. What about the edge cases the developer has long since
forgotten? Unless you've also got a good test suite that covers those cases,
you're exposing yourself to the risk of missing those edge cases in a sans-
source re-write.

~~~
jasongullickson
You're absolutely correct. However I would argue that, if you are in a
situation where the developer (developers, development team, etc.) is no
longer is aware of these edge cases, you have bigger problems than a shipping
delay due to a re-write.

------
thristian
It's interesting to look back on this classic JoS article, with the
perspective that Mozilla's rewrite-from-scratch basically kept the
organisation around long enough for Firefox to come along, and look where
_that_ went. If Netscape hadn't made the decision to rewrite, they'd have
released a browser even less well-suited for the then-modern Internet than
Netscape 4 was when it came out, they'd have sunk even quicker, and there
would have been nothing worth salvaging from the corpse - no Mozilla
Foundation, no Suite, and ultimately no Firefox.

~~~
boundlessdreamz
Yeah, If you are being bogged down by legacy code and increasingly falling
behind competitors due to slow innovation, it makes sense to do a rewrite.
Mozilla had nothing to lose by a rewrite and everything to gain. In the short
term they suffered immensely falling behind even more but in the long term it
helped them emerge stronger.

It is the same with Classic Mac -> OSX. The former was crumbling under its own
weight but OSX enabled Apple to out innovate others.

The key point is that a rewrite should always produce something better and
leaner. Two cases where it didn't happen are

* In case PG's viaweb -> Yahoo store. [http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/m...](http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02367.html)

* When Sony acquired Naughty Dog. <http://bc.tech.coop/blog/060118.html>

~~~
jcl
The "Jak and Daxter" postmortem lists Naughty Dog's use of Lisp as the number
five thing under "what went right" and the number one thing under "what went
wrong"...
([http://www.gamasutra.com/view/feature/2985/postmortem_naught...](http://www.gamasutra.com/view/feature/2985/postmortem_naughty_dogs_jak_and_.php?print=1))

The rewrite wasn't a clear loss -- especially if, as the postmortem suggests,
there was exactly one person who was capable of modifying the old codebase.
(Likely this is the same person being quoted in Bill Clementson's article,
which suggests some amount of ownership bias. Come to think of it, the same
could be said of the ViaWeb case...)

~~~
boundlessdreamz
True..but since Naughty Dog's features were due to it being written in Lisp,
wouldn't it have been better if Sony trained people in Lisp ?

------
camperman
This article has not dated well at all. Compare IE's security track record
with, er, just about any other browser and it's clear that sometimes throwing
away a teetering house of cards and starting again is absolutely the best
thing to do.

~~~
jmtame
didn't they do that on one of the mac os versions too? and it turned out to be
one of the best choices jobs claims he made?

~~~
rms
Yes, OS X, but they started with FreeBSD so it doesn't quite count.

~~~
boundlessdreamz
It does count, they may have started with FreeBSD but they also had to
write/rewrite a ton of stuff and throw away APIs and introduce new ones. I
_think_ the FreeBSD code is only a tiny (but critical) part of OSX

~~~
encoderer
The part you're overlooking is that NeXT was as attractive to Apple as it was
because they had a series of high-profile failures to develop a replacement OS
in house.

In Apple's case the re-write idea turned out horribly and the only reason they
made it thru is because a former founder had created a startup years earlier
and had a working OS that Apple could buy and use.

Apple is hardly a poster child for re-writing software.

~~~
rbanffy
At least the look and feel they developed for Copland were re-used in MacOS 8
and 9...

It looked cool, in the late 90s.

------
swombat
It's a delicate point, because on this one Joel is both right and wrong,
depending on the circumstances. He's absolutely right that the "Big Rewrite"
is a very dangerous proposition that should be assessed very carefully, but
sometimes, it is the right choice.

I'll agree that in 95% of the cases it's not the right choice, though. We
programmers do love us a good rewrite, even when it's bad for us.
Incidentally, the Mozilla rewrite was probably in the 5% where it did make
sense.

~~~
lallysingh
I think a fair interpretation is if you have both conditions:

1\. Is the whole code base a maintenance nightmare? 2\. Do we have to change
all of it right now?

Which occurs, rarely. Most of the time a mechanical transform (e.g. Emacs
macro) helps with the annoyances and standards. The rest, a deep refactoring
is needed.

Frankly, dumping the source and starting from scratch sounds a little like
running away from your problems instead of attacking them head-on.

------
joshu
When you see advice containing words like "never" and "always" and "just" you
need to take that advice with a HUGE grain of salt.

Joel's point stands - rewriting for the sake of rewriting is frequently a
mistake. I know it was a huge mistake in the case of Delicious 2, for example.
But that doesn't mean that starting from scratch is ALWAYS a mistake, etc,
etc.

As a programmer and as a manager of a product, I think you basically need to
try a bunch of things and get burned a bunch of times to properly learn when
and where to do things.

------
mpk
Given the state of the code when it was released, I can't really say I blame
the developers for thinking 'screw this'.

Check out the comments they had to delete before releasing the code :
<http://www.jwz.org/doc/censorzilla.html> .

~~~
DLWormwood
I find it a little disturbing that "hack" was one of the censor words,
especially since it has a very specific meaning when appearing in source code
(and many commenting tools even do special processing when it sees this word.)

------
rbanffy
Funny he implies the bundling of IE in every copy of Windows and the threats
against OEMs who thought about bundling any other browser had nothing to do
with the failure of Netscape.

It's true Netscape 4 lasted very long and was tough to improve, but I think
that blaming Netscape for not having resources comparable to Microsoft is not
entirely fair.

A rewrite is a risky proposition and should not be taken lightly. If Netscape
did something wrong it was not to do it right after 4's launch.

~~~
discojesus
_Funny he implies the bundling of IE in every copy of Windows and the threats
against OEMs who thought about bundling any other browser had nothing to do
with the failure of Netscape._

He doesn't just imply it - he says it explicitly in another article of his
[<http://www.joelonsoftware.com/articles/fog0000000074.html>]:

 _"When Microsoft released Internet Explorer 3.0, fast on the heels of IE 2.0,
it was shocking just how good a job they had done. Not only did they replicate
every feature in Netscape's browser, but they added some more features too,
and did it all with an architecture that was robust and strategic. While it is
true that Microsoft used its operating system to help push its browser, it is
also true that they just wouldn't have gotten away with this if their browser
wasn't great. (Case in point: even though Windows out of the box can play MP3
files, everyone I know uses WinAmp, not the Windows Media Player, to listen to
them. Even though MSN is on the desktop, everybody uses AOL. Back when the
browser integrated with Windows was crap, Netscape had 80% market share. So
please stop fretting about the power of bundling.)"_

And moreover, he's correct.

~~~
rbanffy
Everybody _he_ knew used WinAmp (in a time WMP was completely either useless
or non-existent). About 40% of the people I know and work with would not touch
Windows with a pole. Those do not make a significant cross-section of the
market. Just like most people just lives with the OS their computer came with,
most people just live with the browser that is installed by default either by
the manufacturer or by their corporate overlords.

IE3 was the first "good enough" browser that came from Microsoft and, from 98
on, IE came bundled. For those who do not live in and for the web, "whatever
comes with the computer" is what gets used. That was the last nail in
Netscape's coffin.

~~~
discojesus
_For those who do not live in and for the web, "whatever comes with the
computer" is what gets used._

MSN wasn't anywhere near as popular as AOL. But why not? After all, it
satisifed your criterion, because it "came with the computer."

Also, MSN chat is nowhere near as popular as AOL Instant Messenger

Microsoft Money (bundled with my computer) isn't as popular as Quicken.

Microsoft Works isn't as popular as Microsoft Office.

and on and on and on...

The only way bundling matters is if the program being bundled falls into the
category of "Good Enough" for the user in question. IE satisfied this
criterion; MSN did not.

------
jpcx01
I agree. If you're taking over an old crappy Rails project of reasonable
complexity, think about using Pat Maddox's excellent tips on working with
legacy databases. <http://www.patmaddox.com/blog/railsconf_2009_legacy_rails>

It's useful to get the app under a comprehensive test acceptance test suite.
Then you can rewrite and feel comfortable everything is still working.

------
j_baker
Alright, I've been meaning to write up a blog post detailing my thoughts on
this subject. This post prompted me to.

Here it is, enjoy: [http://jasonmbaker.wordpress.com/2009/05/14/programming-
and-...](http://jasonmbaker.wordpress.com/2009/05/14/programming-and-safe-
theater-or-things-you-have-to-do-but-shouldnt-if-you-can-avoid-doing-them-at-
any-cost/)

------
vicaya
Reuse is overrated and rewrite is underrated. It's true that typical first
rewrite suffers from [second/sophomore system
syndrome](<http://en.wikipedia.org/wiki/Second-system_effect>)

The only way to overcome that is to do more rewrites :)

------
rbanffy
And, BTW, "this is the kind of thing you solve in five minutes with a macro in
Emacs" looks almost like Joel Spolsky knew the HN crowd would eventually
come...

------
ashot
chrome

~~~
c00p3r
This is Webkit + V8 + minimalism + usability (and other really good ideas like
comics promotions), so, only V8 is what was written from scratch.

This is very good example of really smart approach. Another one is the reuse
of Java/Eclipse ecosystem for Android development, same as Google App Engine
Java. In both cases they rewrote VMs.

------
c00p3r
Honestly, I didn't understand the reason of re-posting that old stuff.

This man got his niche as a popular blogger and he is really good in that sort
of blah-blah-blah re-telling-the-obvious-things posts.

But why here?

