ThePerfectRewrite

ThoughtStorms Wiki

You know, we didn't expect blah and blah. How could we have been so stupid?

But now we do understand the problem, we'll get it right. So, if we can just take some time out to redesign, rewrite from scratch ...

Part of his advice on PlatformWarsLogic

and links to IncrementalistsVsCompletionists

Sometimes I throw away : http://sdi.thoughtstorms.info/?p=372

A Dialogue

Joel : Don't rewrite code from scratch

Jane : But maybe you need occasional forest fires which destroy / rewrite one module of your code from scratch.

Joel (sceptically ironic) : Are YellowWolves caged in by modules?

Jane : Perhaps decomposition in forests is by ShearingLayer. (AspectOrientedProgramming).

Joel : Clever, but not convincing. Seriously, I'd accept you can scorch the undergrowth. How large a patch of earth would you scorch?

Jane : It's statistical, innit? Probably a PowerLaw, there should be a few large scale rewrites and more smaller ones. After all, you say that rewrites always fail, but there are plenty of new upstart companies with clean new code-bases that spring up to topple larger incumbents who glued up in a BigBallOfMud.

Joel : I wonder if that's just a special case of a model I was reading about recently by RobertAxtell on FirmSizes. Just as Axtell's sim-companies are brought down by a build up of unproductive parasites perhaps big code-bases are brought down by metastasized dependencies.

Jane : They freeze-up. Like IvanIllich's out of control professionalized bureaucracies.

Joel : Yes, but I've yet to be convinced that simply hitting them with some power-distribution of dramatic rewrites is more of the answer than any other kind of ReFactoring.

Jane : Maybe if we see our ball of mud as a ScaleFree network of malign dependencies. In other words a few super-nodes are often responsible for a lot of connectivity. Directed attacks at such SystemPunkts is usually quite effective against this kind of network.

Joel : Then it's all about traditional profiling and analysis

Jane : did I say it wasn't?

Joel hit dogmatism big time in his essay there. Another way to argument against it would be: OK - so you have a spreadsheet and you want a web server - would you just refactor the spreadsheet? The moral here is that it all depends on how far is your target from your current code. I do agree with Joel that programmers are eager to overestimate this distance - but there is some distance that justifies a full rewrite. – ZbigniewLukasiak

Compare :

See also OnNetscape, BigBallOfMud, ExtremeProgramming

CategoryDesign