Consider the source

What is it about Netscape's newly liberated program code that causes geeks to swoon?


Laura Lemay
April 13, 1998 11:00PM (UTC)

It's springtime, when the young geek's fancy turns to thoughts of love. Love of source code, that is. Lots of source code. Hundreds and thousands of lines of source code -- and the more complicated and difficult to understand, the better.

As of April 1, there's a new massive hunk of source code out there setting the hearts of geeks all over the world a-flutter. It's code with a cause. Code with a mission. Code with a silly green mascot.

Advertisement:

I'm referring, of course, to the eagerly awaited public release of the source code for the Netscape Communicator browser. Free the code, the digerati had advised the company, and legions of programmers will beat a path to your door.

And so they did. The browser source, now called Mozilla after Netscape's dinosaur mascot, has spawned nearly unheard-of excitement in the geek community. You can take out the parts of the browser you don't use! You can add the features you've been wanting for years! You can fix the bugs! And, even better, you can help Netscape create a better browser and keep Microsoft from taking over the Internet. No wonder so many programmers are excited: There's only one thing a renegade programmer likes more than getting free source, and that's a chance to help fight the Microsoft Menace.

Are you geek enough to join the cult of the lizard? Even if you aren't a hard-core programmer with years and years of C++ under your belt, you may have become consumed by curiosity, and you may very well have fought your way to www.mozilla.org when the source release was announced, downloaded and even unpacked the archive. But where to go from there?

First of all, you should be aware that taking on free software is a hazardous occupation. The more people who work on a project, the more difficult it is to figure out what's going on in the code. I knew a programmer once who was bored one Sunday afternoon and decided to hack around for a while in the file-system source code for Linux, the operating system of choice in the open-source software universe. On Tuesday morning we broke down the door and found him crouched in the corner, whimpering. (Powerful antidepressants enabled him to return to some semblance of a normal life, and I'm told he's making a good living writing Visual Basic these days.)

Then there are the wizards of Perl, the scripting language preferred by free-software geeks; they're known for having a manic look in their eyes and a tendency to occasionally blather gibberish in polite company ("No, you idiot! You could do that so much more efficiently with a positive zero-width lookahead assertion!"). And it's said that there's a plaque up somewhere at MIT dedicated to the valiant programmers who have given their lives in pursuit of the GNU.

The Mozilla source runs 40 megabytes and 1 million-plus lines of intermingled C and C++ covering Windows and Mac and nearly every flavor of Unix, so diving into it is not an undertaking for those with weak hearts or slow computers. To build and use the free Mozilla source code for the free Mozilla browser, you will probably need to invest several thousand dollars in a new computer. However, if you've been throwing increasing amounts of cash at your computer dealer all along just to be able to run the latest actual Netscape browser, you may be just fine after all.

Advertisement:

- - - - - - - - - - - - -

At any rate, you will definitely need a very modern computer (you know, one less than six days old), bulging with RAM and disk space. The assorted README files for the various Mozilla builds are hilariously blasé about this: "Having at least 128 megs of memory will make your debugging experience noticeably less agonizing." "You should be ok with a 400MB disk partition ..." "One of our beta testers had a machine with only 64MB of physical RAM (VM was off) and it ran out of memory trying to link."

Advertisement:

In other words, do not try this on your 386.

What about the actual code? As I mentioned earlier, there's an awful lot of it -- although nearly 40.3 percent of the file space is eaten up by the Netscape Public License included in every separate file. (And in case you're wondering, I arrived at that percentage through a painstaking scientific process called "making it up.") The NPL is a complex legal document that can be summed up, roughly, as "You may modify this source code. You may not sue Netscape if you screw it up. We are not responsible for any system crashes, memory corruption or emotional anguish on your part. May cause drowsiness, headache, dysmenorrhea and cramp. Please stand behind the white line. Do not operate heavy machinery."

Even without the repetition of the NPL, there's still a lot of code to muck through. If your programming experience up to this point has been making buttons go up and down on your Web pages and writing simple Visual Basic programs to calculate your net worth, chances are good you're going to be somewhat overwhelmed.

Advertisement:

But then maybe you're not interested in actually making changes, or qualified to do so; you just want to see what the code looks like (the "don't want to stare at the car accident, but feel compelled to" factor). Nothing wrong with that. Unfortunately, the rumor mill has it that a substantial amount of the time it took to prepare the source for release involved "sanitizing" the comments to remove the obscene language and various bits of comment graffiti that litter the source code of most commercial products. ("Joe's memory manager really blows goats. I wrote this next function as a grotesque kludge to get around it. Joe sucks and should NOT get any more stock options at the next performance review.")

The result of this is a dearth of gripping, suspenseful reading in the Mozilla source code. John Grisham it's not. What few comments remain are of this sort, from the library that does networking, in reference to the function:

Advertisement:

NET_ChangeMaxNumberOfConnectionsPerContext:

/* set the maximum allowable number of open connections at any one

* time on a per context basis

*/

Such depth, such texture, such intricacy of plot. Only occasionally does something amusing slip through:


/*

* nesting deeper and deeper, harder and harder, go, go, oh, OH, OHHHH!!

* Sorry, got carried away there.

*/

struct lo_FormElementOptionData_struct {

Advertisement:

If you're interested in exploring the source code to find specific features and make them stop, I'll warn you ahead of time that a close reading of the code shows no trace of the following functions, which one thinks must be there, but aren't:

suckUpAllRemainingSystemMemoryAndCrash()
manglePerfectlyLegalHTML()

generateRandomAnnoyance()

gratuitouslyBehaveDifferentlyFromIE()

On the other hand, all traces of Java have been conveniently pre-removed for you (ostensibly for licensing reasons, but no one is going to complain too hard about the added stability, either). And I'd like to make a point of mentioning line 75 of the file pa_tags.h, part of the HTML parsing library, which defines the BLINK tag.

Advertisement:

Just one small comment, snuck in when no one was looking, would disable this blight on the existence of designers everywhere -- and, I think, go a significant ways toward making this particular geek's springtime the best one yet.


Laura Lemay

Laura Lemay has been making fun of Netscape almost as long as Netscape has been around, and isn't about to stop now. But she does think the source code release is pretty darn neat.

MORE FROM Laura Lemay



Fearless journalism
in your inbox every day

Sign up for our free newsletter

• • •