How to Get an Old Well Working Again

Netscape 6.0 is finally going into its first public beta. In that location never was a version 5.0. The last major release, version 4.0, was released virtually iii years ago. Iii years is an awfully long fourth dimension in the Internet world. During this time, Netscape sabbatum by, helplessly, every bit their market place share plummeted.

It'south a bit smarmy of me to criticize them for waiting so long between releases. They didn't exercise it on purpose, now, did they?

Well, yes. They did. They did it by making the single worst strategic fault that any software company can make:

They decided to rewrite the code from scratch.

Netscape wasn't the showtime company to make this mistake. Borland made the same error when they bought Arago and tried to brand it into dBase for Windows, a doomed project that took so long that Microsoft Admission ate their tiffin, then they made it again in rewriting Quattro Pro from scratch and amazing people with how few features it had. Microsoft virtually made the same mistake, trying to rewrite Give-and-take for Windows from scratch in a doomed project called Pyramid which was shut downward, thrown away, and swept under the rug. Lucky for Microsoft, they had never stopped working on the old code base of operations, so they had something to ship, making information technology merely a financial disaster, non a strategic one.

We're programmers. Programmers are, in their hearts, architects, and the first thing they desire to do when they get to a site is to drive the place flat and build something 1000. We're not excited by incremental renovation: tinkering, improving, planting flower beds.

There'southward a subtle reason that programmers always want to throw abroad the lawmaking and start over. The reason is that they think the old lawmaking is a mess. And here is the interesting observation: they are probably wrong. The reason that they remember the former code is a mess is because of a cardinal, fundamental law of programming:

It's harder to read lawmaking than to write information technology.

This is why code reuse is so hard. This is why everybody on your squad has a dissimilar role they like to utilize for splitting strings into arrays of strings. They write their own part because it'south easier and more fun than figuring out how the erstwhile function works.

As a corollary of this axiom, you lot can enquire almost any programmer today about the lawmaking they are working on. "It's a large hairy mess," they will tell yous. "I'd like zip better than to throw it out and get-go over."

Why is it a mess?

"Well," they say, "look at this role. Information technology is ii pages long! None of this stuff belongs in in that location! I don't know what half of these API calls are for."

Before Borland's new spreadsheet for Windows shipped, Philippe Kahn, the colorful founder of Borland, was quoted a lot in the press bragging about how Quattro Pro would be much better than Microsoft Excel, because it was written from scratch. All new source code! Equally if source lawmaking rusted.

The idea that new code is amend than old is patently cool. Former code has been used. It has been tested. Lots of bugs have been found, and they've been stock-still. There'due south nothing wrong with it. It doesn't acquire bugs just by sitting effectually on your hard drive. Au contraire, baby! Is software supposed to exist like an old Dodge Dart, that rusts just sitting in the garage? Is software similar a teddy bear that'south kind of gross if it's non made out of all new cloth?

Dorsum to that two page function. Yes, I know, it's just a uncomplicated function to display a window, merely information technology has grown little hairs and stuff on it and nobody knows why. Well, I'll tell you why: those are bug fixes. One of them fixes that issues that Nancy had when she tried to install the matter on a computer that didn't have Internet Explorer. Another i fixes that problems that occurs in low memory conditions. Some other one fixes that bug that occurred when the file is on a floppy deejay and the user yanks out the disk in the middle. That LoadLibrary call is ugly simply information technology makes the lawmaking work on old versions of Windows 95.

Each of these bugs took weeks of real-earth usage before they were plant. The developer might take spent a couple of days reproducing the issues in the lab and fixing it. If it'south like a lot of bugs, the fix might be ane line of lawmaking, or it might fifty-fifty be a couple of characters, but a lot of work and time went into those ii characters.

When you throw away code and first from scratch, you are throwing away all that knowledge. All those collected bug fixes. Years of programming work.

You are throwing away your marketplace leadership. You are giving a souvenir of 2 or three years to your competitors, and believe me, that is a long time in software years.

Y'all are putting yourself in an extremely dangerous position where you lot volition exist shipping an old version of the lawmaking for several years, completely unable to brand any strategic changes or react to new features that the market place demands, because yous don't have shippable lawmaking. You might every bit well merely close for business concern for the duration.

Y'all are wasting an outlandish amount of money writing code that already exists.

Is there an alternative? The consensus seems to exist that the old Netscape code base of operations was actually bad. Well, it might take been bad, just, you know what? Information technology worked pretty darn well on an awful lot of real globe computer systems.

When programmers say that their code is a holy mess (as they ever practise), there are three kinds of things that are incorrect with it.

Showtime, there are architectural problems. The code is not factored correctly. The networking code is popping upwardly its own dialog boxes from the middle of nowhere; this should have been handled in the UI code. These problems tin be solved, one at a time, by carefully moving lawmaking, refactoring, irresolute interfaces. They tin be done by one programmer working carefully and checking in his changes all at once, then that nobody else is disrupted. Fifty-fifty fairly major architectural changes can be washed without throwing away the lawmaking. On the Juno projection we spent several months rearchitecting at ane point: merely moving things around, cleaning them up, creating base classes that made sense, and creating sharp interfaces between the modules. But we did it carefully, with our existing lawmaking base, and nosotros didn't innovate new bugs or throw away working code.

A second reason programmers think that their code is a mess is that it is inefficient. The rendering lawmaking in Netscape was rumored to exist slow. Only this merely affects a modest office of the project, which you can optimize or even rewrite. You don't have to rewrite the whole affair. When optimizing for speed, 1% of the work gets you 99% of the bang.

Third, the code may be doggone ugly. One project I worked on actually had a information blazon chosen a FuckedString. Some other project had started out using the convention of starting fellow member variables with an underscore, but later switched to the more than standard "m_". And so one-half the functions started with "_" and one-half with "m_", which looked ugly. Frankly, this is the kind of thing you solve in five minutes with a macro in Emacs, non past starting from scratch.

It's of import to retrieve that when you starting time from scratch there is absolutely no reason to believe that you are going to do a better chore than you lot did the showtime time. Starting time of all, you probably don't even have the same programming team that worked on version one, so y'all don't actually accept "more experience". You're just going to make well-nigh of the sometime mistakes again, and introduce some new problems that weren't in the original version.

The old mantra build one to throw away is dangerous when practical to large scale commercial applications. If you lot are writing code experimentally, you lot may want to rip up the function you wrote last calendar week when yous think of a ameliorate algorithm. That's fine. You may desire to refactor a class to get in easier to utilize. That'south fine, as well. But throwing away the whole program is a dangerous folly, and if Netscape actually had some adult supervision with software industry experience, they might not have shot themselves in the foot and then badly.

bradydozedilitry.blogspot.com

Source: https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/

0 Response to "How to Get an Old Well Working Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel