Slashdot Mirror


When Rewriting an App Actually Makes Sense

vlangber writes "Joel Spolsky wrote a famous blog post back in 2000 called 'Things You Should Never Do, Part I,' where he wrote the following: '[T]he single worst strategic mistake that any software company can make: They decided to rewrite the code from scratch.' Here is a story about a software company that decided to rewrite their application from scratch, and their experiences from that process."

54 of 289 comments (clear)

  1. Here's my short list by Anonymous Coward · · Score: 4, Funny

    5. When it is written in Visual Basic. Always.
    4. When I'm getting paid by the hour and it is written in Visual Basic. Always
    3. When it was written in a mid-90s WYSIWIG bastard child of a mid-80s interpreted language.
    2. When it uses a thousand "IF-THEN-ELSE" when it means to use regular expressions
    1. When it is written in Visual basic.

    1. Re:Here's my short list by beakerMeep · · Score: 2, Insightful

      See if someone put in a bunch of cryptic RegEx, I would re-write it as If-then-else statements.

      For me readability > length of code.

      I always find it funny when developers are struggling to fit their code on as few lines as possible. Like the forgot how to scroll or something.

      Still, if it was written in Visual Basic, I'd let you take care of it.

      --
      meep
    2. Re:Here's my short list by PRMan · · Score: 5, Funny

      5. When it is written in Visual Basic. Always.
      4. When I'm getting paid by the hour and it is written in Visual Basic. Always
      3. When it was written in a mid-90s WYSIWIG bastard child of a mid-80s interpreted language.
      2. When it uses multiple five-to-ten thousand line case statements
      1. When it is written in Access basic.

      This is why I am currently rewriting everything from scratch in .NET at my company.

      --
      Peter predicted that you would "deliberately forget" creation 2000 years ago...
    3. Re:Here's my short list by Tanktalus · · Score: 5, Insightful

      Regarding regexes, I've gone both ways: I've had my developers remove regexes where they were trying to use them, and I've had them add regexes where they were trying too hard to avoid them. Regexes aren't the answer, they're a single tool. You need to use them right. And the /x modifier in Perl helps a lot, allowing you to put useful whitespace and comments in the code (and a regex is code as much as any other language).

      As for "as few lines as possible" - you need to do it right. When you span your code over 3 pages, that's not readable anymore. I harp on this with my developers all the time: SCOPE. Scope applies to variables, comments, and functions. The less I need to look at to understand what you're doing, the more likely it is I'm going to understand it. A huge 3-page if-elseif-elseif-else is going to be something I'm not going to understand, as I'll have forgotten all the conditionals by the time I get to the end to know really what scenarios are left - sequential access. A concise regex, on the other hand, is something that I can skim over just by moving my eyes - random access. These concerns aren't just valid for storage media (tape vs DVD/HD). Of course, 40 characters of regex special characters with no whitespace (either horizontal or vertical, preferably both) is generally going to overwhelm most readers, and is going stupid in the other direction.

      Yes, readability trumps length of code. But sometimes that means to use a regex (or two or three - why make one big cryptic one when multiple simpler regexes can do the job?). And sometimes, that means avoiding them when what you really want to do is better done by another piece of code.

      My favourite new-to-regex example recently has been someone trying to pull apart colon-delimited text with a regex. Woops - there are better language constructs for tokenisation, whether that's strtok in C or it's split in Perl (or better, Text::CSV_XS). Got rid of that regex in a hurry.

    4. Re:Here's my short list by hjf · · Score: 4, Informative

      dude, THIS is the regex to validate an email address: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html

    5. Re:Here's my short list by Surt · · Score: 5, Insightful

      You should think about investing in learning tools. Regex is a well documented, well understood, capable feature of all modern languages. How many weeks will you spend debugging / refining your thousands of if/then/else when you could trust years of testing that has been done on regex engines? Your statement reminds me of novices who avoid ?: in favor of if/else because it's 'cryptic'.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    6. Re:Here's my short list by Surt · · Score: 2, Informative

      That has to be the +5 funniest thing I've read in a month. Thank you, I just about fell out of my chair.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    7. Re:Here's my short list by WDot · · Score: 3, Insightful

      You could just put in a comment that says "This regex tests for an email address."

      I've massaged if-else code into regexes before. Having several if-elses for a piece of data is rickety and (in my opinion) would take more work to rework than a regular expression if the data changed.

    8. Re:Here's my short list by Sarten-X · · Score: 4, Interesting

      My supervisor is (rightfully) wary of regexes, due to their reputation for unreadability. My favorite solution (in Java): Make a bunch of string constants to match various elements, then assemble those strings together into more strings, which are finally assembled into a single real regex. Sure, it takes about 15 lines for a moderately-complicated regex, but readability is superior to using 15 lines of indexof and substr.

      And now, to just bring up a topic that I have a personal interest in:

      Nobody knows how to write parsers anymore. I've never seen a recent university CS curriculum that covers parsing with respect to different parser constructs for different languages. Sure, the students learn to load up the chosen XML parsing library and pull in XML, and they learn to take text from stdin, but there's seldom any emphasis on what to do with more screwy formats. Maybe, just maybe, they might get exposed to different languages through a compilers class, but generally not how to process different languages outside of lex/yacc. This bothers me greatly.

      --
      You do not have a moral or legal right to do absolutely anything you want.
    9. Re:Here's my short list by willy_me · · Score: 2, Insightful

      If there is a problem with the regex you simply have to debug it - this is programming after all. The reason why the comment is important is that the debugger must know exactly what the regex is supposed to do. Is is any valid email addresses? Are there any exceptions? Once a programmer knows exactly what the code is supposed to do they can go about fixing it. Attempting to derive what the coded is supposed to do from the currently broken code is a recipe for disaster.

    10. Re:Here's my short list by BiggerIsBetter · · Score: 2, Insightful

      Your statement reminds me of novices who avoid ?: in favor of if/else because it's 'cryptic'.

      It's not about being cryptic. I use if/else and I've been cutting code for decades. if/else and ?/: do the same thing, while one is easier to read while you're scanning through lines of code (it's just English after all). That the novices can understand what's been written is a bonus.

      --
      Forget thrust, drag, lift and weight. Airplanes fly because of money.
    11. Re:Here's my short list by BikeHelmet · · Score: 2, Interesting

      Nobody knows how to write parsers anymore. I've never seen a recent university CS curriculum that covers parsing with respect to different parser constructs for different languages. Sure, the students learn to load up the chosen XML parsing library and pull in XML, and they learn to take text from stdin, but there's seldom any emphasis on what to do with more screwy formats. Maybe, just maybe, they might get exposed to different languages through a compilers class, but generally not how to process different languages outside of lex/yacc. This bothers me greatly.

      Warning: Long rambling post follows. To summarize, I haven't found any courses that covered anything close to parsing, except maybe invoking XML parsing libraries and stuff.

      Before I took any programming courses, I figured out how to create an XML parser in javascript. I had a dream of making a game, which needed server-side storage, but I never got around to finishing it. Quite an experiment, though.

      After that I went on to help decode Outpost 2's compiled map format. (maps were DLL files - oh the design choices of old games!) I wrote an editor for it in Jamascript (a mirror of Javascript - see Clickteam), and wrote my own tile renderer with smooth scrolling. It worked quite well, except in XP SP2. Lack of further interest from the community caused that project to die, but got me interested in compiled languages - with a compiled language, I'd be in control of whether it worked on an OS or not.

      So I decided I needed to learn a compiled language, but since I didn't like C, I started by porting my XML parser to Java, and added writing capabilities. I used it for some projects where I didn't need to deal with DOM nodes and stuff; I just needed to spit out data as XML <key>value</key> pairs, which it did just fine. Although the parser was simple(200 lines, max?), and couldn't read complex XML, it could generate valid simple XML, which any other parser could read. Oh, and it failed gracefully if the file was too advanced. (that was my biggest accomplishment, and required rethinking how I had designed it)

      Then I changed it to pre-pend itself to other files as a sort of metadata. That way I could attach info like the number of frames, size of frames, etc. to a tileset PNG. You can see where I was going with this... I wanted to make a game. But somehow I got bored and stopped working on it again.

      All this working with Java led me to a few inevitable conclusions. I just plain don't like some of Java's syntax verbosity. Some of the choices make the code stretch on and on and on, when readability could be enhanced by doing the opposite. I wrote a code pre-processor, to enable (among other things) keywords like public: and private: - also var, so that I could easily deal with statements like this:

      public ArrayList<SomeObject> myList = new ArrayList<SomeObject>();
      ->
      var myList = new ArrayList<SomeObject>();

      It just felt cleaner to me - perhaps because of my javascript roots. I had a dream of creating an entire IDE, with background colours (changing based on scope, public/private, etc.), but I never actually got around to writing that... in the end I went back to other IDEs which lacked my features, but had stuff like code completion. (quite handy)

      Now I'm working on many other projects - but I must say, I haven't encountered a course yet that covered any of this stuff. I'm probably looking at the wrong college courses, or maybe there's just not enough jobs that demand it? I had no trouble finding, Ruby, Python, Java, C#, and C++ courses, but none cover this stuff. I just had to tinker to learn it.

    12. Re:Here's my short list by jesset77 · · Score: 2, Insightful

      You can step through a large block of code bit by bit with the debugger. You can't do that with a regex.

      I think this post really illustrates the gulf between those who fear regex and those who do not.

      A lot of coders today simply do not know how to code (or know how to and avoid doing so), they know how to set breakpoints in a debugger looking for large duplo-blocks of code to comment out or alter in predictable ways until the code outputs what they expect from it.

      Now if we are lucky, if we are very lucky the coders who do this are forced to at least write regression tests for their changes. But at the foundational level, they don't know what they changed or why it worked, they just banged the code with a hammer until the rattling stopped. Not having to do so again next month is above their payscale.

      Once you abandon this dangerous approach and assume that debugging involves actually grokking the code, then regex suddenly becomes the right tool for a wide variety of parsing jobs. While obviously very terse, it is also rich in it's ability to comment, build larger pattern matches out of smaller, atomic, easily tested pattern matches, etc.

      Regex requires someone familiar with Regex to debug. Pages of if-then-else require someone with an automated debugger and no hope of seeing the bigger picture to debug. Regex simply wins this battle, so long as the author is careful to comment and build up well labeled match strings atomically. I am not trying to say that a majority of regex slingers do The Right Thing, I am saying that with if-then-else alone it is not possible to do The Right Thing and no amount of debugger-friendliness changes that.

      --
      People willing to trade their freedom of expression for temporary entertainment deserve neither and will lose both.
  2. Re:And why? by XnR'rn · · Score: 3, Informative

    I am about half way through the article in the second link, and it is really interesting, and informative. :>
    Maybe not news, but it is worth your time (or at least mine).

  3. Re:Missing the point by mikael_j · · Score: 4, Informative

    Actually, from what I got from the article it seems they also felt that the basic design of the original version of application just wasn't good enough, that it was in fact seriously lacking and that a gradual rewrite would take longer and not accomplish what they wanted (to clean up and future-proof their application).

    --
    Greylisting is to SMTP as NAT is to IPv4
  4. Re:And why? by vlangber · · Score: 2, Informative

    Hi!

    I'm the author of the blog post. The Joel article is 10 years old, but not the one I wrote(the the second link).

    Vidar Langberget

  5. Sometimes to move forward by rxan · · Score: 3, Interesting

    you must stop looking backward.

    1. Re:Sometimes to move forward by dotancohen · · Score: 4, Interesting

      you must stop looking backward.

      And loose all your users. They are in your 'Backwards" direction.

      I have filed or triaged well over 1000 bugs for KDE since KDE 4 came out. Forget about the missing features from KDE 3 to KDE 4, they don't care about breaking compatibility from KDE 4.n to KDE 4.n+1. Even Kaddressbook, one of the core KDE apps, had severe functionality loss from KDE 4.3 to KDE 4.4. Amarok, Koffice, and other lose severe core functionality when their "new versions" were actually "technology previews" with dot-oh version numbers.

      --
      It is dangerous to be right when the government is wrong.
    2. Re:Sometimes to move forward by Anonymous Coward · · Score: 2, Interesting

      The new Amarok just blows period. They could have actually done mockups and put it to a vote using a poll on their site, produced two or three demo UIs with only basic functionality implemented, put it to another vote and gone with that. In the end, the devs really just wanted to reinvent the UI because table views are so 2001.

      The result is slow as a pig, ugly and more confusing then the old one.

      Hell, I hate it so much that I now just use a Konsole instance running MPlayer instead. mplayer album/*/*.flac FTW.

    3. Re:Sometimes to move forward by SomeKDEUser · · Score: 2, Insightful

      Basically, I am questioning the common wisdom the KDE4 and Amarok 2 are failures. I question them mostly because whatever reproach there might be usually is stale. Stale as in: "this was fixed a year ago, now".

      But hey, questioning common wisdom on slashdot is good for burning karma. Remember kids: thrashing free projects based on false impressions you got a year ago is fine. Defending them with actual evidence goes against truthiness, and we can't let a fact-based discussion take place.

      But this is something I noticed: I have been hanging on slashdot since 1999 (lost my password/login at some point). It used to be that the general knowledgeability of the audience was much higher. As in, you could actually expect the average slashdotter to know some basics of computer science and of having made some contribution to a free project. Or at least be a scientist/engineer of sorts.

      Now, it is mostly ranting wanabees and crazy libertarian/ultraconservative mouthpieces that do most of the talking. Not that they are a majority, be who wants to argue with these...

  6. Ugh by drinkypoo · · Score: 4, Interesting

    Drupal does indeed brutalize your database (see second link). So looking forward to D7 to clean this up. That alone was sufficient justification to rewrite the application :p

    Unfortunately the author goes on to display his ignorance before this is all over: There are also other examples of total rewrites that have been successful. Apple's transition to OS X is a very good example. The classic Mac OS was an operating system with some good ideas, but the core architecture had a lot of problems. Did Apple make a bad decision to start from scratch with OS X? I don't think so. They brought over and improved the best bits from OS 9, and merged it with the solid Darwin core (much like we did). Uh, no, you are totally and completely fucked here. They started with NeXTStep, last updated in 1995; it was itself based on an older version of BSD (4.3?) and an older version of Mach. OSX is not a complete rewrite of anything. Its legacy stretches back into the 1980s, and so does its code.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    1. Re:Ugh by drinkypoo · · Score: 5, Interesting

      But Apple did rebuild their GUI shell, application APIs, etc. from scratch. Sure the underlying OS is based on legacy code stretching back into, really, the 1960s (BSD itself was, after all, based on AT&T's Unix), but the GUI and application APIs were totally new.

      That is totally and completely false. "Cocoa is one of Apple Inc.'s native object-oriented application program environments for the Mac OS X operating system. It is one of five major APIs available for Mac OS X; the others are Carbon, POSIX (for the BSD environment), X11 and Java. [...] Cocoa is the continuation of several frameworks (primarily the App Kit and Foundation Kit) from the NeXTSTEP and OPENSTEP programming environments developed by NeXT in the 1980s and 1990s." "Carbon descends from the Toolbox, and as such, is composed of "Managers". Each Manager is a functionally-related API, defining sets of data structures and functions to manipulate them. Managers are often interdependent or layered.
      Newer parts of Carbon tend to be much more object-oriented in their conception, most of them based on Core Foundation. Some Managers, such as the HIView Manager (a superset of the Control Manager), are implemented in C++, but Carbon remains a C API." And I should HARDLY need to touch on POSIX, X11, or Java, the former two of which were already functions of NeXTStep, and the latter of which was not invented at Apple.

      There is NOTHING in OSX which can reasonably be believed to have been invented (in any sense of the word) for OSX! Period, the end. ALL portions of OSX contain legacy code, from the microkernel to the presentation layer. They didn't go from Display Postscript to Display PDF because it was easy, they did it because they couldn't just throw over Display Postscript and be able to utilize existing GUI code. They didn't throw out the GUI and replace it, they replaced the engine under it, then made it work on that engine. The appearance of the GUI is still customizable, as it was under NeXTStep, by mangling the images it's made of.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:Ugh by jeti · · Score: 2, Insightful

      The original rewrite of MacOS was Copland, which used up Apples development resources for five years before it was cancelled.
      http://en.wikipedia.org/wiki/Copland_(operating_system)

    3. Re:Ugh by drinkypoo · · Score: 3, Insightful

      The original rewrite of MacOS was Copland, which used up Apples development resources for five years before it was cancelled.

      Yeah, I remember that, it's what convinced me to stop being a Mac user. I had the INIT or CDEV or whatever that made your MacOS look like Copland. Then they cancelled it and brought out another shitty MacOS, and I ran like hell and never looked back. All the years from System 7 through System 9 were sad, abusive times to be an Apple customer. They kept bringing out inadequate hardware at astounding prices and almost spent all their cachet. Another year or two and they wouldn't have had enough fans left to float OSX.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    4. Re:Ugh by Vellmont · · Score: 2, Insightful


      When I cook biscuits from scratch, I don't start with baking mix, or leftovers. I start with flour, and eggs, and water, and milk, and baking powder,

      All of which are components you didn't create yourself. You didn't, for instance start out with flour seeds, chickens, cows, hydrogen, oxygen, an acre of farmland and whatever you'd need to create baking powder.

      The point of my analogy is of course that much like in cooking, everyone in software development starts with some ready made component. Is taking NextSTEP off the shelf and starting with that really any different than buying eggs at the grocery store?

      --
      AccountKiller
  7. There are actually a few good reasons by Opportunist · · Score: 4, Interesting

    The problem is that companies usually rewrite for all the wrong reasons.

    A good reason would be the emerge of a new technology that supports your problem much better, to the point where redoing your code from scratch means easier maintainance later. Usually this goes hand in hand with an old technology (the one you used so far) getting abandoned by its maker. A good example would be how I had to maintain a client/server app written in VB6 using DCOM. Not some quick hack, a full blown client/server solution it was never meant to be, that also has to communicate with a SAP interface and a few more nifty things that cried out "please rewrite me". The overhead to maintain it soon turned from insane to nuts and even the tinyest change required a team of four people to work for weeks.

    Unfortunately, the reasons why something gets rewritten are usually different. Like at my next gig. A pretty well designed and fairly solid piece of code was thrown out when the original creator was fired and someone with an ego that required its own office took over and insisted we use "his" collection of libraries instead of that "old" libraries. We trashed about 2 manyears of labour down the drain to end up with what we had before.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
    1. Re:There are actually a few good reasons by jonwil · · Score: 2, Interesting

      Often the problem is that there are things that should be rewritten (either whole apps or specific sections of code) but no-one is willing to green-light such a rewrite even though the rewrite will take less time than bolting hack after hack on top of the old system.

    2. Re:There are actually a few good reasons by Kijori · · Score: 3, Informative

      I quite like the way that the article claims that it shows an exception to Spolsky's rule, but actually isn't at all: they claim to have started off as a successful CMS company with "big name" clients, embarked on a rewrite that took them off the market for two years and ended up as a tiny player with "more than two hundred web projects [...] in Norway".

      As far as I can tell this is a project that went exactly the way Spolsky predicted: they had a decent product, they embarked on a rewrite that took longer than they expected and they lost the market by doing it.

    3. Re:There are actually a few good reasons by vlangber · · Score: 2, Informative

      You're correct, we were reasonably successful before the rewrite started, but we started to see limitations in the original architecture that would become much bigger problems in the future. So yes, we traded growth for a while, in order to get a solid foundation. We still think we made the right decision, as we feel our future prospects are so much better now, than if we had continued with the old system. Time will tell.

  8. 6 KB wasted on fucking VIEWSTATE data. by Anonymous Coward · · Score: 2, Informative

    I just looked at their article, and 6 KB of the page was near-useless VIEWSTATE data. If they can, they really should disable the generation of that. It's a useless artifact of the broken ASP.NET WebForms approach, which isn't really even necessary for a blog like theirs.

    Seriously, with a typical Slashdot posting resulting in 80,000 unique hits for the target site, they're going to waste over 480 MB of bandwidth serving up just that useless VIEWSTATE data.

    1. Re:6 KB wasted on fucking VIEWSTATE data. by vlangber · · Score: 4, Informative

      Thanks for noticing..

      The blog module uses templated controls. When you bind data to a templated control, all that data get's stuffed into the viewstate as default. To fetch the comment content, the template for a comment has this snippet:

      <%# Container.CommentContent %>

      As default in .Net, a literal control is created for that data. Strangely Microsoft decided to make EnableViewState enabled by default for automatically created controls. The reason the viewstate is so big on that page is because I forgot to put the above snippet in a Literal control with viewstate enabled:
      <asp:Literal runat="server" ID="litBlogCommentContent" EnableViewState="false" Text=""></asp:Literal>

      I usually check the size of the viewstate, but none of the blogposts I checked had any comments, so I didn't catch it when we created the site. I'll update it as soon as traffic slows down a bit.

    2. Re:6 KB wasted on fucking VIEWSTATE data. by Rockoon · · Score: 5, Funny

      If they can, they really should disable the generation of that. It's a useless artifact of the broken ASP.NET WebForms approach, which isn't really even necessary for a blog like theirs.

      Are you suggesting a rewrite?

      --
      "His name was James Damore."
  9. There are times for a rewrite and port. by AnonymousClown · · Score: 4, Insightful
    The article was interesting in how they made their decision and I don't think it was necessarily a bad decision - assuming their assessment of the old version was correct. The process looked like it broke down in the design and planning phases. The article didn't go into detail on the design and planning; which kind of leads me to believe that may have tried to do the "superstar" programmer thing and rewrite it over a weekend. Anyone whose been in development long enough has heard the "he coded it over the weekend"stories and the programmer "street cred" it gave - at least back then.

    I've seen rewrites/ports go quite well. Systems that were originally on mainframes and needed or wanted to be moved to cheaper hardware for cost - if it was the proper thing to do (Sometimes you really need the metal).

    Another rewrite that went well was a bunch of code that over the decades became so convoluted to be a maintenance nightmare - modify one thing or add on functionality and then break a shit load of other things.

    Just do these basica things and it'll work out.

    Go back to the specs and start there.

    Talk to the stake holders - yep, there will be creep but also feature reduction because there are things that they never used or because it doesn't make sense anymore.

    Plan, plan, plan. No cowboy programming and hacking out shit. And document everything.

    It can work.

    --
    RIP America

    July 4, 1776 - September 11, 2001

  10. The exceptions Joel should have included by michaelmalak · · Score: 4, Interesting
    Joel's article implicitly had some tunnel vision because it did not state any exceptions. The general rule of thumb as to when to rewrite an application are:
    • Change in platform paradigm. This has happened five times thus far (post-ENIAC):
      1. Mainframe to MS-DOS
      2. MS-DOS to Client/Server
      3. Client/Server to Windows
      4. Windows to Web
      5. Web to mobile
    • Vast improvement in software technology (and you have a software project/product that requires significant expansion or improvement), such as:
      1. Machine code to Assembly
      2. Assembly to spaghetti
      3. Spaghetti to structured
      4. Structured to OO
      5. Proprietary unsupported language for obsolete sluggish database to SQL
    1. Re:The exceptions Joel should have included by 16K+Ram+Pack · · Score: 2, Insightful

      The other problem is with scale.

      When a company starts a new project or an entrepreneur starts a small business it's sensible to build something quite small and straightforward. It might take off, but it might not, so don't spend more on the tech than you really need.

      So, something gets produced that's VERY hacky. And for a short term solution and from a business perspective, that's quite bright.

      The problem is that scale it up a little and it starts falling apart. It becomes hard to maintain because the fundamentals are so poor. It's generally much better to spend the time rewriting at this point than living with what you've got.

  11. Re:And why? by WrongSizeGlass · · Score: 3, Insightful

    I'm going to forward your blog post to several clients and colleagues. The clients need to see why I make sure they know what they want before we start development (they never understand how hard it is to change infrastructure on the fly or just "do it again"), and the colleagues because they need to stop selling one product as something else that can "do what you need with just a little bit of tweaking".

    We do some small custom web apps for clients, and even a few that have the potential to grow into bigger (but not big) products. While rolling out one of them this week, to the first of three clients who have ordered it, I'm already designing a complete re-write of the core of this product. What started out as a small helper app for one client has turned into a PITA to scale up and out for these other clients. Clearly it's better to fix it now than to keep patching & splicing in order to make it work for them ... until we sell it to someone else who wants "just one little change ...".

  12. Re:Missing the point by commodore64_love · · Score: 4, Interesting

    Well here's a story from the stone knives and bear claws-era (early 80s):

    Two programmers were tasked to convert the Atart VCS/2600 game Pitfall 2 to a Commodore=64 and Atari 800 computer. One said, "The Atari console is so primitive that it's easier to recreate the whole game from scratch," and the other said, "No just copy the 6502 code and then modify it for the varying graphics/sound chips." They then went their separate ways.

    - The Commodore=64 programmer recreated the whole game from scratch, and produced a slightly-flawed but decent port.

    - The Atari 800 programmer simply dumped the code directly, and then modified it. He produced a port that played identical to the original PLUS he had enough time left-over that he added a whole other game (basically Pitfall 3). So Atari 800 purchasers got two games for the price of one.

    Reworking is faster than starting over. Even if the design is a complete mess, there's typically SOME modules that can be reused, and that's time saved

    --
    "I disapprove of what you say, but I will defend to the death your right to say it." - historian Evelyn Beatrice Hall
  13. Re:Missing the point by mikael_j · · Score: 2, Insightful

    You're assuming that the original design isn't an organically grown mess of code that's grown and mutated over the last 10+ years (this is pretty common on the business world), preferably written in some proprietary and deprecated language (ASP + VBScript is a current classic, most likely pushed to the company as a good "business language" by some MS sales drone). After ten years of "organic" growth of such apps cleaning them up generally takes longer than just rebuilding from scratch in a sane language with proper separation of presentation, business logic and data storage, exporting the database to the new database and calling it a day. Really, I've done this more than once and sometimes these code bases end up so rotten that it's painful to fix minor bugs, stuff that should take thirty minutes ends up taking the better part of a day because the entire codebase is a total mess with include-o-mania run wild (anyone remember that from the PHP3 days as well? lots of if(condition) { include("filename.php"); } crap that almost impossible to follow).

    --
    Greylisting is to SMTP as NAT is to IPv4
  14. What, no plus sign? by tepples · · Score: 2, Informative

    I noticed that your regular expression doesn't allow the plus sign as a valid character in e-mail addresses. For example, a lot of e-mail providers allow receiving mail at, say, pino+regexlib@example.com, which gets put in the same mailbox as pino@example.com but tagged with "regexlib". See here for instance.

  15. Don't pay so much attention to Joel Spolsky. by Animats · · Score: 5, Interesting

    Look. Spolsky runs a dinky little software development firm that sells a little project management program. And it's still a dinky little software development firm after a decade. It's not like this guy runs a company that does anything critical, like avionics software, or anything really big and tightly integrated like Facebook, or financially significant like Chase's banking system, or leading-edge robotics like Boston Dynamics, or cutting-edge manufacturing like HyperMill. No, they just do Windows and Mac desktop apps. That's trailing edge technology at this point.

    Some of the better shops don't hesitate to rewrite. Some have systems which intercommunicate by message passing and are designed to be rewritten in sections. (Facebook, works that way internally.) The bigger shops may have one team on the new version and a maintenance team on the old one; a small firm may not be staffed for that.

    1. Re:Don't pay so much attention to Joel Spolsky. by kmike · · Score: 3, Interesting

      Yes, I never understood why so many pay attention to Joel's inflammatory rants.

      I don't even want to start on his company's product (Fogbugz). Seriously, ASP/VBScript translated to PHP? And then inventing a new programming language just for a web app with ability to output in several other languages? Ugh.

    2. Re:Don't pay so much attention to Joel Spolsky. by Vellmont · · Score: 2, Insightful


      Yes, I never understood why so many pay attention to Joel's inflammatory rants.

      Partly because he's a fairly good writer, and partly because he seems to offer simple solutions to the larger problems of software, and partly because he's right at least some of the time.

      I DO think he's just dead wrong on this issue though. In my experience starting from scratch is something that should be very carefully considered, but rejecting it outright on general principles is wrong. I really don't care much about his bona-fides or how successful he's been. People with big impressive resumes working for some fashional part of the industry writing in the cool language of the day can say some really stupid things.

      The problem starts when people start believing someone PURELY on the reputation alone, and turn their brain off. There's a few figures like that that gain a lot of hero status. Joel is one of them, Bernstein is another. A lot of people actually don't like thinking very much, and prefer ANSWERS to hard questions (even if they're the wrong answers). The cult figures in software offer these answers, defend them to the death, and attract people with similar attitudes. It winds up looking like these guys have large followings, when in reality they have minuscule, but extremely dedicated and vocal ones.

      --
      AccountKiller
    3. Re:Don't pay so much attention to Joel Spolsky. by inf4mia · · Score: 2, Insightful

      It's not like this guy runs a company that does anything critical, like avionics software, or anything really big and tightly integrated like Facebook, or financially significant like Chase's banking system, or leading-edge robotics like Boston Dynamics, or cutting-edge manufacturing like HyperMill. No, they just do Windows and Mac desktop apps. That's trailing edge technology at this point.

      Yeah, it's not like he's ever done anything significant...

      Spolsky started working at Microsoft in 1991[4] as a Program Manager on the Microsoft Excel team, where he designed Excel Basic and drove Microsoft's Visual Basic for Applications strategy.[5] He moved to New York City in 1995 where he worked for Viacom and Juno.

      http://en.wikipedia.org/wiki/Joel_Spolsky

    4. Re:Don't pay so much attention to Joel Spolsky. by sootman · · Score: 3, Informative

      Dinky company, perhaps, but quite successful at a personal level. In less than ten years, Joel took his company from zero to seven million dollars per year by my accounting.

      http://joelonsoftware.com/articles/BionicOffice.html
      $700 per employee in the original office

      http://joelonsoftware.com/items/2008/12/29.html
      "built for 18 employees" = about $12,600/month

      http://www.inc.com/magazine/20080601/how-hard-could-it-be-adventures-in-office-space.html

      "When we moved into our current offices, our rent had been equal to 15 percent of revenue, which was high. But the company grew, and today our rent is only about 2 percent of revenue."

      So revenue was $84,000/mo ($1,008,000/yr) and is now about $7,500,000/year.

      So he's not a complete waste of space. And he may not be God but that doesn't mean he's never right and/or never worth listening to. READ THE F ARTICLE about rewrites--plenty of Slashdotters (you included) have been here long enough to know that at least, his example about Netscape/Mozilla is 100% accurate. They lost YEARS because they chose to rewrite everything.

      And judging by the comments here, I think a lot of people are reading the title and thinking he's saying "never make any changes." That is 10000% NOT what he is saying. He's saying "never throw away 100% of your code and start over from scratch." If you actually read his original article (I know, I'm new here) you'll see a lot of really good points.

      Joel isn't God, but he isn't just some stumbling moron either. There IS a continuum between those two extremes, you know.

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  16. Re:Why I want to rewrite by Abcd1234 · · Score: 4, Interesting

    I want to rewrite my old code at work... But only for one reason: I am a lot better programmer now than 5 years ago. And 5 years ago, I was a lot better than 10 years ago. And in 5 more years, I have no doubt I'll feel the same way.

    There's actually one other reason most programmers would like to rewrite what they're working on: They've solved the problem once, and now they understand it.

    IMHO, you can't solve a problem properly without solving it twice. Unfortunately, that's just not, in general, tenable in the industry, and so instead we have things like XP, which encourage prototyping and refactoring, which accept that maxim and attempt to allow for it in the process. Unfortunately, *that* requires preeminent design skills, and that's something lacking in your average developer.

  17. Re:Missing the point by St.Creed · · Score: 4, Insightful

    Whenever I hit my thumb, I blame the stupid hammer as well.

    Or, in other words: a fool with a tool is still a fool.

    You can use assembly and have decent code, with clear separation of concerns. Or you can have a 4GL programming tool and still make a mess. Which is exactly why some programmers are 10 times more productive than others.

    So where I worked we had ASP+VBScript (supplemented with VB6 COM+ modules running with transactional integrity on an Oracle database) and clean modules, separation of concerns and code that we could easily understand and maintain (even the junior programmers had no trouble getting used to it in a few weeks). We built most of the business apps in the last place I worked on such a design. It still works, is very easy to maintain and transfers cleanly to IIS 8 and Windows 2008. All our database code is in a single (small) module, same as the business layers. Presentation layers is a bit more complex but when transferred to .NET you can just get rid of it altogether because .NET takes over that part. Which is exactly what is happening now, ofcourse.

    Don't blame the tools for the lack of ability of most programmers.

    --
    Therefore, by the (faulty) logic you're using, you're just a cow with a keyboard - osu-neko (2604)
  18. Re:And why? by The+End+Of+Days · · Score: 2

    Don't worry about refuting a zealot, the two technologies have pretty much nothing in common anyway.

    Not that I'm a fan of either approach, exactly, but this was just a cheap jab at Microsoft based on prejudice. You should be expecting that around here by now, your user id is low enough.

  19. Re:And why? by Z00L00K · · Score: 4, Interesting

    I have been through a similar project - rewriting a solution that did run under OpenVMS using Basic, Java, C++, C and a bunch of DCL scripts (that confusingly enough for DOS persons have the file extension .COM)

    Target environment was Linux and language used was Java 1.6.

    My experience when rewriting a legacy system that have a crapload of varying solutions that has evolved during 25 years or so you will find that there is always yet another functionality that nobody told you about - effectively doubling the development time. (This "Multiply estimated time by PI factor" statement isn't that far off.)

    And there were some traps involved too - migration of the system had to be seamless for the users as much as possible and with minimal downtime. Since there were over 400 different customers with everything from 1 to 1000 users each involved this was to say the least "tricky". Especially since this was a 24x7 system. The solution was to write a replication protocol that replicated data between the old system and the new. The old system used OpenVMS indexed files while the new system runs a MySQL database and the data structures were different too, which made it necessary to write a replication solution. So when a customer was migrated it was effectively done by setting a flag that redirected them from the old system to the new system and they could continue working.

    Of course there were bugs in the beginning, and user errors since the new system did have different functionality and behavior compared to the old. Bot none of them were causing any irrecoverable problems. Invoice printing was delayed, but no major amount of money was lost. The majority of the problems appearing didn't affect the end users at the customers, only the helpdesk service personnel and they were prepared for limitations ahead of time.

    The amount of downtime for the system during the two years it has been operational has been very low. And this has given a different concern - too few "problems" with a system is also a problem because tech support will almost forget that it exists.

    Specific problems with the application - especially in the beginning has been running out of PermGen space in Java. This at least partly due to design mistakes. But memory leaks that grows over time are very low. And the use of FindBugs has been very useful to trap a lot of errors (potential and real).

    What the application does? - It's a management application for short-term lease of telephony at hospitals and similar (almost 400) and other services (a few) which enables and disables phone extensions, assigns numbers, allows instant move of an extension and provides invoicing for the rental and phone usage through processing of CDR:s.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  20. Rewrite if existing s/w congeals by presidenteloco · · Score: 2, Insightful

    Often a rushed, under-resourced or under-skilled s/w project will congeal into a large, brittle, solid clot,
    which is not extendable without breaking things in mysterious prohibitive to fix ways.

    Congealment comes from insufficient or ill-conceived architecture, and/or rushed or ignorant ill-fitting extensions or mods or "fixes",
    combined with insufficient continuous re-factoring.

    This code may be worth keeping on expensive life-support if there are many existing customers depending on it,
    but make no mistake. Your codebase is already dead, even if its heart still beats.

    So then, if you still need software with similar but slightly updated or extended functionality, you should rewrite,
    and in doing so, make sure you get good architecture, take sufficient time to build each part or layer, evaluate the quality of
    all third party libraries or frameworks used (on the "volleyball" principle that the weakest member of the team drops the ball
    and determines the team's i.e. the system's quality), use continuous refactoring, with technical-risk based work prioritization
    (biggest risks dealt with first, always), document the classes and methods
    sufficiently, and include unit tests and/or invariants and pre-postconditions, so that there is a lower probability that
    further extensions will start congealing into brittle, excess complexity.

    If you can succeed at maintaining that discipline without going bankrupt, then it will have been worth it, because the value
    of your new software capital asset will be much greater than previously.

    Of course you should have done it right the first time, (and should have had management enlightened enough to let you,)
    because it would have been much cheaper to do it carefully once, than the punishing expense of the original crappy
    development and maintenance plus the rewrite. There IS a valid argument that by the time you let your s/w congeal into
    a complex, brittle clot, you are already too late, and you should pull the plug, shed a tear, and walk away.

    --

    Where are we going and why are we in a handbasket?
  21. This is a very simple question by Chris+Newton · · Score: 2, Insightful

    Whether to do The Big Rewrite always boils down to one very simple question: do the expected gains outweigh the expected losses?

    Usually, the argument against doing a rewrite boils down to two key points:

    1. it takes time and resources just to get back to what you already had, which confers no immediate business benefit; and
    2. you risk losing the bug fixes and special cases that have accumulated during the real world use of the original implementation.

    Those are certainly valid concerns, and IME it is often true that their impact is underestimated. However, what the doomsayers tend to ignore is all the potential benefits from writing a second version of something from scratch but with the experience gained from doing it once already:

    1. you can design based on the knowledge accumulated during the real world use of the original implementation, giving code that might be easier to maintain in future and/or allowing you to add new functionality that was not realistic before;
    2. you can refine your requirements based on that same experience, cutting out things that haven’t helped in practice and cleanly integrating requirements that weren’t anticipated the first time around, leaving you with a code base that is fitter for its purpose;
    3. while you lose all the old bug fixes and special case handlers, you also get to clear out all the old hacks and bolt-on workarounds that are maintenance hazards and a high risk of causing future bugs; and
    4. the best tool for the job the first time around might not be the best tool for the job any more, and a rewrite lets you revisit that decision and take advantage of any relevant advances in development tools, programming techniques, industry knowledge, etc.

    I’m sure some rewrites really are just because a developer wants to write something new instead of working with what is already there, and those are almost always a bad idea IMHO. On the other hand, it can be annoying if someone comes in assuming that this is the only possible motivation for a rewrite, without considering whether there is another justification for the decision.

  22. My $.02 by gyrogeerloose · · Score: 2, Insightful

    I'm not a real programmer. I used to play with BASIC back 25 years ago or so and I've fooled around with writing C code for microcontrollers a bit lately but my skills are very limited to say the least. None the less, I was able to parse that regular expression without too much trouble. That leads me to believe that it can't be all that hard for someone who codes for a living to understand it. Still, it would be helpful to spend a minute or two with some helpful commenting.

    --
    This ain't rocket surgery.
  23. Re:Missing the point by pommiekiwifruit · · Score: 2
    They got source code? That makes it a lot easier. :-) source code with English comments would be even better...

    (Japanese beat-em-ups for example are notorious for vast wodges of copy-and-pasted assembly code that is hard to understand if you can't follow the Japanese comments).

    Anyway, the kernel of a 2600 game (which is half the code) is completely unlike a C64 game engine. The game logic would have been easy to port so it would make sense to keep that. And I would hope the graphics and sound were much improved anyway (I quite like pitfall 2 on c64 as it happens).

    But "dumping" the code (i.e. reverse engineering a 2600 game from just the ROM) is time consuming especially back then when the tools would have been non-existent. Now we would use a debugging edition of MESS but on a 4.7MHz PC it would be another matter altogether, and a lot of time things were converted "by eye" instead.

  24. Rewriting works sometimes, without a doubt by crispytwo · · Score: 2, Informative

    I worked for a company that rewrote the same application three times in different technology. 2 time using MS .net tech - aspx, .net desktop, and 3rd with PHP.

    The first incarnation was a disaster from a performance/scalability point of view, but we did learn the (surprisingly complex) business requirements very well.
    The second incarnation was good, developed quickly, but missed the target market -- nobody wanted a desktop app
    The third performed much better than either predecessor, was simpler to maintain, and actually made money... still is.

    There was some desire to rewrite it a fourth time, but that has been abandoned in favor of extending the existing system has been the current methodology.

    The lesson here is "if it sucks, rewrite it". And more often than not, it is too costly to not rewrite it. Specifically, if the system was not rewritten a third time, the company could not (and would not) exist. As it sits, the product is quite good at what it does. The balance is looking 5 or 10 years forward and looking 1 year forward. If the system you are using won't last 1 year forward, let alone 10, a rewrite may be needed, duh!

    The second lesson is "if it is not perfect, fix it". (In the third case it would last a year, but fixing it would maybe make it last 3 or 5 -- it's going on 5 now, and is looking good for another 5)

    What this person seems to be faced with is the same thing as that of COBOL ... asp is old tech, nobody really wants to work with it, and it definitely is not perfect. A rewrite is the only sensible thing. (And yes, anything in COBOL should be rewritten too.)

  25. Joel contradicts the IEEE by Todd+Knarr · · Score: 2, Informative

    Joel's position contradicts a paper I read years ago in an IEEE software journal that basically said you needed to plan on rewriting your application about every 7 years or have it collapse on you. The logic in the paper was based on two things I've found to be true in the real world. First, the world changes. Individually it's small changes, but looking at it on the half-decade-to-decade scale it can add up to huge differences in what's needed in the software. Second, software isn't infinitely extensible/adaptable. Any software has a basic architecture and world-view, and a limit beyond which it can't be pushed without an exponential increase in the time and effort needed to successfully make the changes. The two combine to mean that at some point it simply becomes technically infeasible to extend and adapt an existing system. The requirements have changed too much and you're having to fight the system trying to make it do, not just what it wasn't designed to do, but what it was actively designed not to do.

    Now, business doesn't like this. It doesn't make sense from a business perspective, and it'd be much better to simply keep adapting and extending what's already there. But that ignores the fact that something must be technically feasible before you can even ask whether it makes business sense. If you've got the best idea in the world that'll make the business tons of money while giving you a virtual monopoly in the field and reducing costs by 99%, that basically is from a business standpoint the absolutely ideal thing to do, but it requires the manufacture of say room-temperature superconducting wire by the mile, then it just ain't gonna happen. How desirable it is from a business perspective doesn't matter because it just isn't technically possible at this point in time.

    I also liken it to building a 20-story office tower. It's tempting to start with a simple one-story building and slowing add to it until you've got what you want, but the foundation of a one-story building just isn't going to be able to support a 20-story tower. You might be able to get 2 or 3 stories out of it, but at some point you're going to have to tear the whole building down and re-do the very foundations themselves to support the greater weight.