TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How much does this Joel's article hold true?

4 pointsby sankaraalmost 15 years ago
http://www.joelonsoftware.com/articles/fog0000000069.html<p>I'm working on a startup and the current codebase is 2.5 years old. The original code was built with a lot of assumptions (or future predictions rather); very few of it hold true today. Also, a major goal back then was to just get it out. A lot has changed and it has become a rather hard problem to maintain it. I'm not talking about bug fixes; it's adding new features that is taking at least 2x the time it actually needs. A couple of us (only in out part time and without disrupting the existing code base) are planning to retouch it; rethink the assumptions as it holds today and incorporate best practices. However my manager is pointing me to the article above and says we are at fault here. Have you been in a situation like this? What would your suggestion be?

5 comments

btillyalmost 15 years ago
Feel free to ignore that article IF you know what you are doing. Joel has a lot of opinions, that usually sound really good, and only some of them have any validity.<p>For example the Netscape codebase that he complained about went on to become Mozilla, which was the base for Firefox, which has done pretty well. Furthermore there was actually no choice about rewriting the original - once Netscape pulled out the bits that were owned by other companies they didn't have running code. When the only code you've got clear rights to won't run, drastic measures are called for.<p>For another example, Perl 5 was a complete rewrite of Perl 4 from scratch. The result was a much more powerful, extensible, and simpler language. (Yes, Perl 4 was grammatically much more complex than Perl 5.) Perl 5 has been far more successful than Perl 4. (Some 15 years in the result is creaky, but there are still a lot of people using it.)<p>On the flip side I've encountered some true disasters caused by the refactoring mantra. When you start refactoring in place, it is like you're living in a construction zone. Worse yet, as you reconstruct it, your opinions on how to write it will change, and you're likely to change how you're refactoring it. After a few generations of this, you get a real mess.<p>That said, <i>usually</i> refactoring is a better idea than a rewrite. There are a <i>lot</i> of examples where complete rewrites have lead to major disasters. (If I'm feeling snarky I'd use Perl 6 as an example.) And businesses have real cause for concern about spending years rewriting a system, with the end result that they get back to where they started but with more bugs.<p>Furthermore be warned that the second attempt to write a piece of software is notoriously hard to do right. Look at <a href="http://c2.com/cgi/wiki?SecondSystemEffect" rel="nofollow">http://c2.com/cgi/wiki?SecondSystemEffect</a> for a description of some of the pitfalls. So be very, very cautious about starting such an effort.<p>All of that said, if the code is a big mess 2.5 years in, then you probably have something else going wrong. In my experience good software developers in a good environment don't generally wind up in that much trouble that fast. I'm not a big fan of assigning fault. But odds are good that neither developers nor management are blameless. And if you've got the same developers, and same management, it would be silly to predict a significantly different result.<p>Still if you want to start a rewrite, the first question is whether or not you have good unit tests. Because if you don't, then it will be much, much harder to be sure that your rewrite is doing the right thing. Furthermore I can virtually guarantee that the act of trying to write tests for the existing system will give lots of opportunities to find significant improvements.<p>If you've brought it up to the point that you have a good set of unit tests, and you still think that the rewrite is necessary, then you'll be in a much better position to pursue that. And if you still have pushback from management, well, it will be some time down the road from now, improving the code will have improved your skills, and hopefully the economy will be in good enough shape that a better job won't be that hard to find...
评论 #1374286 未加载
评论 #1374395 未加载
nandemoalmost 15 years ago
Clickable link: <a href="http://www.joelonsoftware.com/articles/fog0000000069.html" rel="nofollow">http://www.joelonsoftware.com/articles/fog0000000069.html</a><p>I think one key point is:<p>&#62; <i>The old mantra</i> build one to throw away <i>is dangerous when applied to large scale commercial applications</i>.<p>How big is your application? How many users does it have? Do you already have a good regression test suite?
评论 #1374266 未加载
cousin_italmost 15 years ago
Following Joel's advice may or may not make you better off. Can't really tell without going into technical specifics. Can you tell us more about your case?<p>Our current product (online mapping for corporate clients) went through multiple rewrites when it was already quite successful: the client side went from JavaScript to AS2 then to AS3, the server side went from PHP to C#, and in addition to that many big parts of the project were rewritten from scratch multiple times. None of this was ever done just to "incorporate best practices", though.
评论 #1374413 未加载
RiderOfGiraffesalmost 15 years ago
tl;dr : Re-writes are usually a disaster - be absolutely certain of your ground before undertaking one.<p>========<p>The major question to ask is "why?" - and ask it repeatedly.<p>* Why is it a mess?<p>* Why do you think writing it from scratch will be faster than fixing it?<p>* Why do you think you can spend the time creating nothing new for X weeks while you re-write?<p>* Why do you think you will produce something better/smaller/faster/cleaner/less buggy?<p>Here are some thoughts:<p>* Maybe it's a mess because the original design was fundamentally wrong and it really can't be guided into the right form.<p>* Maybe it's a mess because people kept adding features without really understanding how it worked, so their additions didn't fit the architecture/design/structure.<p>But maybe it's a mess because it's doing stuff you don't yet recognize as being important, so what's there is essential complexity.<p>Some anecdotes and background.<p>I've overseen two complete re-writes, and five on-going re-workings. One re-write was a success both technically and commercially, the other was a near complete disaster. Four of the re-workings are still underway and the product has remained live, sellable and profitable the whole time. The fifth is under constant review, but is not a disaster.<p>So re-writes can work, but the experience is that they usually don't. Go against the advice only if you are certain of your facts.
评论 #1374453 未加载
lelelealmost 15 years ago
Have you good unit tests? Then you can refactor/rewrite it as you please. Consider rewriting a section a time.