Blake Ross on Popup Suppression

« Return to Article
  • Belcat 2006-09-15 10:14
    <p>You forgot the other big WTF: Netscape 6.&nbsp; Releasing a browser that could barely work was a real WTF and probably cost them whatever was left of their Netscape fans...</p><p>&nbsp;</p>
  • Nobody 2006-09-15 10:17
    They should have put Paula in charge of that. :)<br />
  • Jeff Olhoeft 2006-09-15 10:19
    <p>&gt; a Netscape engineer who shan&#39;t be named once passed a pointer to
    JavaScript, stored it as a string</p><p> &gt; and later passed it back to C,
    killing 30</p><p>&nbsp;31, my brain dropped core and I can&#39;t get it to reboot. <br />
    </p>
  • Jamison R. 2006-09-15 10:21
    Clever post.&nbsp; I like the ones that don&#39;t deal exclusively with code.<br />
  • ammoQ 2006-09-15 10:22
    <p>[quote user=&quot;Anonymous&quot;]They should have put Paula in charge of that. :)<br />[/quote] </p><p>*LOL*</p><p>PHB: Paula, are you done removing&nbsp; the popup blocker?</p><p>Paula: 95% completed, sir.</p><p>PHB: Brillant!&nbsp;</p>
  • HidekiAI 2006-09-15 10:33
    <p>&gt;Netscape engineer who shan&#39;t be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30</p><p>Please tell me you&#39;re joking about the &quot;pointer -&gt; string -&gt; garbage&quot; part, I believe the part about 30 dead victims caused by this effect though...</p>
  • zip 2006-09-15 10:38
    Quite a solid tale given the total absence of code.&nbsp; I especially like the blaming-AOL part, because, come on&nbsp;who doesn&#39;t hate AOL?
  • Mithras 2006-09-15 10:39
    Oh, that&#39;s just beautiful. Truly an excellent WTF, and the fact that it can be blamed on marketing makes it all the better.
  • byte_lancer 2006-09-15 11:00
    [quote user=&quot;Alex Papadimoulis&quot;]<p> a Netscape engineer who shan&#39;t be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30&nbsp;</p><p>[/quote]</p><p>We really want to know more about this 30 part.</p><p>Did it kill 30 processes (WTF) ? or threads ? or connections ?</p><p>I have a hunch this has got something to do with the string processing functionality in spidermonkey.<br /></p><p>[quote user=&quot;Alex Papadimoulis&quot;]</p><p> To make things right, Netscape quickly released a version 7.01 that included it, but only after renaming it the &quot;popup suppressor&quot; (&quot;popup decongestant&quot; was trademarked). </p><p>[/quote]</p><p>After reading this submission, I think we must trademark the term &quot;WTF suprressor&quot;.</p>
  • dfssgsgsdf 2006-09-15 11:12
    <div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div>
  • Gedoon 2006-09-15 11:19
    I think it was just a funny figure of speach, rather than a fact... It is a great wtf indeed, but luckily netscape doesn&#39;t control a heart rate monitor or anything... A friend of mine is a testing engineer at a company that produces software for hospital equipment, she&#39;s dealing the sort of software that really really really has to work, come hell or high water. I&#39;m talking robust with capital R... So far no casualties... :)<br />
  • Anonymous 2006-09-15 11:32
    [quote user=&quot;byte_lancer&quot;]We really want to know more about this 30 part. <p>Did it kill 30 processes (WTF) ? or threads ? or connections ?[/quote]</p><p>Pleeeeease tell me&nbsp;that&#39;s sarcasm.&nbsp; It&#39;s a news-story-like phrase, like &quot;hurricane&nbsp;damages AOL headquarters, killing 30.&quot;</p><p>&nbsp;Anyhow, thanks for this WTF.&nbsp; I didn&#39;t realize how much AOL&#39;s influence affected Netscape&#39;s development and functionality after the acquisition...I&#39;d wondered if AOL would do something like that but didn&#39;t follow the details too closely, and sure enough.</p><p>I think the&nbsp;main WTF here is AOL&#39;s idiocy and its let&#39;s-listen-to-marketing-above-all policy&nbsp;more than Netscape itself.&nbsp; It&#39;s a shame AOL is essentially no more, though, we&#39;re missing out on the possibility of many more AOL-related WTFs in the future..</p>
  • Michael Casadevall 2006-09-15 11:39
    Ack, I remember Netscape 7, and remembering that the only feature N7 vs. Mozilla 1.0 had was that Netscape 7 had an AOL Instant Messenger client built into it, while Mozilla didn&#39;t (it had Chatzilla). I also remember the WTF of Netscape 6 - I was a beta tester for it :-/
  • Michael Wojcik 2006-09-15 11:46
    A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it's used during the lifetime of the object that it points to, without invoking undefined behavior.

    It's spelled out in black and white in ISO 9899-1999:TC2. The real WTF is that some people still haven't memorized every single word of the C specification. Geez.

    (Prolepsis: Of course I agree pointer->string->pointer is not a Good Idea.)
  • anonymous 2006-09-15 11:47

    <p>Its amazing how <a href="http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/chimera/src/application/Attic/AppDirServiceProvider.cpp&amp;rev=1.4&amp;root=/cvsroot"> ugly code</a> can become soo good app like Firefox. A shame XUL is not a standard, too.&nbsp;
    </p>
  • neven 2006-09-15 11:48
    <p>Awesome post - best writing I&#39;ve seen on The Daily WTF. Kudos etc.<br /><br />By the way, did anyone chuckle at this home-brewed WTF?</p><blockquote><strong>Blake Ross on Popup Suppression</strong><br /><br /><strong>Alex Papadimoulis</strong> wrote the following post at 09-15-2006 10:00 AM:<br /><br />Hi all, <strong>Blake Ross</strong> here. Alex asked me to guest write a post this week...<br /></blockquote><p>&nbsp;</p>
  • Ghost Ware Wizard 2006-09-15 12:00
    <p>Well,</p><p>&nbsp;Most of the features users want are not promised to them at all by the people that know better (i.e. the manager with a masters degree and no coding experience vs. the programmer with 10+ years of code slogging and a college dropout with a &quot;C&quot; average).&nbsp; The ones they hate are usually &quot;undocumented features&quot;.</p><p>&nbsp;Cheers!</p>
  • Kiss me, I'm polish 2006-09-15 12:40
    <p>Netscape&#39;s history is full of WTFs.</p><p>Throwing away the release 4 code is one - that was working and tested code, even if full of bloat. See http://joelonsoftware.com/ - the guy explains it much better. Shipping the release 6 was another - ok, so it was all beautiful, yet it needed a powerful machine to run at the time - and compared to version 4, honestly, that wasn&#39;t much of an improvement. Then there was version 7, which was Mozilla&#39;s crippled child with full of AOL-related stuff, of which the annoying running man in the systray was the most useful. And there was version 8, which looked like Mozilla on drugs, bombed the country with randomly placed rss feeds, didn&#39;t support Mozilla&#39;s extensions (why? that was the hooray thing!) and had the menu bars all messed up in order to look shiny. Good lord, it didn&#39;t even have mouse gestures if i remember correctly.</p><p>I&#39;m actually surprised the company still exists.<br /></p>
  • George 2006-09-15 13:06
    And so the young student found himself saying &#39;wtf?&#39;, and then he installed Opera for the first time, and the web was... good.<br /><br />Great post, reminded me of that faithful weekend where I finally ran IE by choice for 20 minutes while I looked for alternatives.<br /><br /><br />
  • AgentConundrum 2006-09-15 13:10
    FYI, the Joel On Software article mentioned can be found <a href="http://www.joelonsoftware.com/articles/fog0000000069.html">here</a><br />
  • punissuer 2006-09-15 13:10
    <blockquote><p>passed a pointer to JavaScript, stored it as a string and later passed it back to C</p></blockquote><p>This is beyond a WTF--this is an OMG.&nbsp; I can&#39;t stop giggling.<br /></p>
  • Sergio 2006-09-15 13:19
    This was one of te best WFT posts ever. Perfectly contextualized and unnoticeably codeless. Thanks for this great piece of software marketing history.
  • my name is missing 2006-09-15 13:32
    Someone who worked at Netscape in the early days said they hired 100 engineers before they ever hired a QA person. Explains a lot. Captcha is:clueless<br />
  • wyz 2006-09-15 13:35
    <p>[quote user=&quot;zip&quot;]Quite a solid tale given the total absence of code.&nbsp; I especially like the blaming-AOL part, because, come on&nbsp;who doesn&#39;t hate AOL?[/quote]</p><p>Who doesn&#39;t...? How about Ted Turner, he did agree to AOL&#39;s takeover of Time-Warner.</p><p>&nbsp;No wait... maybe he does hate them. Within months his reported net&nbsp;worth went from $10B to $2B.</p><p>captcha: quality </p>
  • Carnildo 2006-09-15 13:38
    [quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2.[/quote]<div><br class="khtml-block-placeholder" /></div><div>Yes, but does the spec say anything about what should happen if that string is passed through a Javascript applet?&nbsp; I&#39;m fairly sure that&#39;s undefined behavior.</div>
  • James Aguilar 2006-09-15 13:43
    What is so ugly about that code?<br />
  • Brendan Kidwell 2006-09-15 13:51
    <p>Speaking of marketing department-induced WTFs, are any other loyal Opera users really turned off by the Opera 9 propaganda (currently visible in the Sponsored By widget on this site)? Those &quot;example&quot; users are so stereotyped, none of them are actually like you at all, no matter who you are. If you follow the link and read the copy, it comes off like the campaign was designed by a high school student.</p><p>&nbsp;(Edit: Okay, so I clicked this ad, and I was lead to a user-friendly feature list instead of the crappy marketing stories. Maybe they ditched everything but the silly photos of supposed Opera users.)<br />&nbsp;</p>
  • Pap 2006-09-15 13:56
    They&nbsp;should&nbsp;get&nbsp;<a href="http://www.theonion.com/content/columnists/view/kornfeld" shape="rect" title="Herbert Kornfeld">Herbert Kornfeld</a>&nbsp;to be their spokesperson.
  • KattMan 2006-09-15 14:15
    [quote user=&quot;Brendan Kidwell&quot;] <p>Speaking of marketing department-induced WTFs, are any other loyal Opera users really turned off by the Opera 9 propaganda (currently visible in the Sponsored By widget on this site)? Those &quot;example&quot; users are so stereotyped, none of them are actually like you at all, no matter who you are. If you follow the link and read the copy, it comes off like the campaign was designed by a high school student.</p><p>&nbsp;(Edit: Okay, so I clicked this ad, and I was lead to a user-friendly feature list instead of the crappy marketing stories. Maybe they ditched everything but the silly photos of supposed Opera users.)<br />&nbsp;</p><p>[/quote]</p><p>Ther is an opera ad?&nbsp; Where?&nbsp; All I see is the two BG girls.&nbsp; Why oh why can&#39;t we get BG Girls, beanbag girl and foosball girl all in one ad?&nbsp; I&#39;d never log out!</p><p>As for todays WTF, isn&#39;t this how all companies release a product these days?&nbsp; Gone are the days where people actually took pride in the software they released to the public.&nbsp; Oh wait, those days never really happened did they.&nbsp; All good software releases were accidents corrected in the next version.</p><p>captcha=stfu&nbsp; (I think I will)</p>
  • MattChaput 2006-09-15 14:18
    <p>Oh Blake, this WTF was awesome, but I wish you&#39;d used the opportunity to share some dirt about how the hell Mork happened. (Unless it&#39;s just &quot;The guy didn&#39;t have a clue what he was doing,&quot; but, well, it&#39;s *got* to be funnier than that! Look at it!)<br /></p><p>http://jwz.livejournal.com/312657.html</p><p>&nbsp;</p>
  • Anonononymous 2006-09-15 14:25
    [quote user=&quot;Brendan Kidwell&quot;]<p>Speaking of marketing department-induced WTFs, are any other loyal Opera users really turned off by the Opera 9 propaganda (currently visible in the Sponsored By widget on this site)? Those &quot;example&quot; users are so stereotyped, none of them are actually like you at all, no matter who you are.</p>[/quote]<br /><br />They seem a like a little weird choice for spokespeople, but I don&#39;t let things like that bother me. It&#39;s just advertising. Everything in advertising is fake.<br />
  • Ray, Ireland 2006-09-15 14:39
    <p>[quote user=&quot;Anonymous&quot;]They should have put Paula in charge of that. :)<br />[/quote]</p><p>&nbsp;aww, I haven&#39;t thought of paula in weeks!</p>
  • Little Idea 2006-09-15 14:39
    <p>Another WTF is the fact that AOL&#39;s core product was integrated with IE all the while.&nbsp;</p>
  • HT 2006-09-15 14:46
    <p>The story with Netscape 6 is not so straight. Remember, by that time Netscape and all the Mozilla volunteers had worked for years, Netscape marketshare was going down, and there was basically nothing to show. So Netscape 6 was released in a hurry to put something at least barely usable out. It was known to be pretty horrible, but the marketing was well done and the press loved it. Until they tried to use it for a couple of days...</p><p>So yeah, it turned out to be even crappier than expected, and the backslash was pretty bad marketing.</p><p>But what most people fail to realize was that it was great for engineering. The web was full of articles how Netscape 6 failed in this or that. It was tracked pretty carefully by Netscape and the community QA, and bugs were filed. Netscape 6 included also the crash reporting tool (Talkback), and it sent tons of crash data back to Netscape. In about 6 months Netscape 6.1 was released, and it was an amazing leap from 6, mostly because of the enormous feedback from Netscape 6. And it just got better and better from there (barring marketing mishaps like 7 without popup blocking).</p><p>The first 20 million copies of Netscape 7.1 (I think, been a while), was downloaded in a lot shorter period than Firefox 1.0&#39;s 20 million, and there was no marketing push for 7.1 at all. So although 6 was a marketing disaster, by 7.1 there were a lot of people happy with the product and downloading it without any marketing effort.<br />&nbsp;</p>
  • VGR 2006-09-15 15:03
    [quote user=&quot;Anonymous&quot;]
    <p>Netscape&#39;s history is full of WTFs.</p>
    <p>Throwing away the release 4 code is one - that was working and
    tested code, even if full of bloat. See http://joelonsoftware.com/ -
    the guy explains it much better. </p>
    <p>[/quote]</p>
    <p>I knew someone was going to bring up Joel&#39;s &quot;never throw away the code&quot; article.</p>
    <p>Joel is dead wrong and so are you.&nbsp; In fact I recommend reading <a href="http://www.laputan.org/mud/">The Big Ball of Mud</a>,
    as it&#39;s far more insightful and sheds light on the unfortunate and
    seemingly inevitable cycle of code becoming so bloated and tangled that
    it has to be thrown away, because it reaches a point where over 99% of
    developers&#39; time is spent on maintenance or just plain scratching their
    heads.&nbsp; (I firmly believe it is possible to *not* end up having
    throw away a codebase, even after decades, but it requires much more
    diligence and skill than most programmers are willing to exercise, and
    it requires a manager with a clue where software development is
    concerned.)</p><p>I&#39;m especially surprised that anyone still stands
    behind Joel&#39;s article, considering the success of Mozilla and the fact
    that it&#39;s brought an excellent browser to so many platforms.&nbsp;
    Looking back, throwing away the Netscape 4.x code seems like the best
    thing that&#39;s ever happened to the browser world.<br />
    &nbsp;</p>
  • MattChaput 2006-09-15 15:08
    Well, I doubt Mozilla proves anything either way. First, the Mozilla development was a death-march of feature creep and over-engineering. Who knows if it might have been a lot faster if they just fixed the old base? And Firefox is the real success story, not Mozilla, and its developers didn&#39;t throw away the Mozilla codebase, as ugly as it is (I love running into bugs in the Mozilla API, checking the code, and finding an unimplemented stub function).<br />
  • Dazed 2006-09-15 15:13
    Anonymous:
    Netscape&#39;s history is full of WTFs.
    <p>Throwing away the release 4 code is one - that was working and tested code, even if full of bloat.


    You must be using a different meaning of 'working' to the one I am used to. Its CSS support in particular was unbelievably bug-ridden, and I understand the code was such a tangled mess that there was really no chance of CSS ever being made to work.
  • BT 2006-09-15 15:24
    <p>I actually liked Netscape 4, 6 and 7. Reason?&nbsp; I made a good living writing all of my CSS, HTML and Javascript code two and sometimes 3 times to get it to work right in IE, NS4.x and NS6+.&nbsp; Its unreal how many companies standardized on NS 4 and then 6.&nbsp; It made programming the web hell, and also very profitable at the same time.&nbsp; 3x the work == 3x the fees.&nbsp; :-)</p><p>&nbsp;</p><p>Take care,</p><p>&nbsp;</p><p>Brian&nbsp;</p>
  • Anon E. Mouse 2006-09-15 15:29
    <p>[quote user=&quot;Anonymous&quot;]Throwing away the release 4 code is one - that was working and tested code, even if full of bloat. See http://joelonsoftware.com/ - the guy explains it much better.[/quote]In fairness, I believe much of the reason that happened was because there was so much proprietory junk tied up in the NS4 codebase, it couldn&#39;t be released.</p><p>That said, the NS4 rendering engine was well and truly borked. Though whether any of it could have been recovered, we&#39;ll never know.</p>
  • stevekj 2006-09-15 15:37
    [quote user=&quot;VGR&quot;][quote user=&quot;Anonymous&quot;]
    <p>Netscape&#39;s history is full of WTFs.</p>
    <p>Throwing away the release 4 code is one - that was working and
    tested code, even if full of bloat. See http://joelonsoftware.com/ -
    the guy explains it much better. </p>
    <p>[/quote]</p>
    <p>I knew someone was going to bring up Joel&#39;s &quot;never throw away the code&quot; article.</p>
    <p>Joel is dead wrong and so are you.&nbsp; In fact I recommend reading <a href="http://www.laputan.org/mud/">The Big Ball of Mud</a>,
    as it&#39;s far more insightful and sheds light on the unfortunate and
    seemingly inevitable cycle of code becoming so bloated and tangled that
    it has to be thrown away, because it reaches a point where over 99% of
    developers&#39; time is spent on maintenance or just plain scratching their
    heads.</p><p>[/quote]</p><p>I don&#39;t think you quite got the point of Joel&#39;s article.&nbsp; It wasn&#39;t that code never has to be rehashed, sometimes extensively.&nbsp; As you and Joel both know, it does.&nbsp; The point is that throwing everything out and starting from scratch is the wrong way to go about that, especially if you want to be commercially successful.&nbsp; The correct and commercially successful way to rehash your code is to do it a bit at a time, moving this here, moving that there, untangling this knot, sweeping all the lint away from that other ball of mud over there, and at each step your code still does exactly what it did before, and you can still ship it if you have to.&nbsp; But after a certain period of time, you have a code base that bears almost no resemblance to the old one, but contains exactly the same well-tested functionality, and if you are even a little bit careful, no new bugs.&nbsp; For Joel this process took two weeks.&nbsp; For Netscape 4.x I can imagine it might have taken a bit longer, but not 3 years!<br /><br /></p>
  • pjsson 2006-09-15 15:43
    [quote user=&quot;Anonymous&quot;][quote user=&quot;Anonymous&quot;]Netscape&#39;s history is full of WTFs.
    <p>Throwing away the release 4 code is one - that was working and tested code, even if full of bloat.[/quote]

    You must be using a different meaning of &#39;working&#39; to the one I am used to. Its CSS support in particular was unbelievably bug-ridden, and I understand the code was such a tangled mess that there was really no chance of CSS ever being made to work.[/quote]</p><p>Throwing away the release 4 code was a WTF for sure since it was what killed the Netscape browser. Maybe refactoring the code wouldn&#39;t have worked, but we now know that the total rewrite was a WTF!<br /></p>
  • makomk 2006-09-15 16:13
    <p>[quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2. The real WTF is that some people still haven&#39;t memorized every single word of the C specification. Geez.

    (Prolepsis: Of course I agree pointer-&gt;string-&gt;pointer is not a Good Idea.)[/quote]&nbsp;</p><p>It&nbsp; may well be permitted by the standard, but it&#39;s potentially confusing to the programmers. (There&#39;s all sorts of standards-compliant but insane things that can be done with C, anyway - see <a href="http://www.ioccc.org/">the IOCCC</a> for some examples.)<br /></p>
  • Carnildo 2006-09-15 16:19
    [quote user=&quot;stevekj&quot;][quote user=&quot;VGR&quot;][quote user=&quot;Anonymous&quot;]
    <p>Netscape&#39;s history is full of WTFs.</p>
    <p>Throwing away the release 4 code is one - that was working and
    tested code, even if full of bloat. See http://joelonsoftware.com/ -
    the guy explains it much better. </p>
    <p>[/quote]</p>
    <p>I knew someone was going to bring up Joel&#39;s &quot;never throw away the code&quot; article.</p>
    <p>Joel is dead wrong and so are you.&nbsp; In fact I recommend reading <a href="http://www.laputan.org/mud/">The Big Ball of Mud</a>,
    as it&#39;s far more insightful and sheds light on the unfortunate and
    seemingly inevitable cycle of code becoming so bloated and tangled that
    it has to be thrown away, because it reaches a point where over 99% of
    developers&#39; time is spent on maintenance or just plain scratching their
    heads.</p><p>[/quote]</p><p>I don&#39;t think you quite got the point of Joel&#39;s article.&nbsp; It wasn&#39;t that code never has to be rehashed, sometimes extensively.&nbsp; As you and Joel both know, it does.&nbsp; The point is that throwing everything out and starting from scratch is the wrong way to go about that, especially if you want to be commercially successful.&nbsp; The correct and commercially successful way to rehash your code is to do it a bit at a time, moving this here, moving that there, untangling this knot, sweeping all the lint away from that other ball of mud over there, and at each step your code still does exactly what it did before, and you can still ship it if you have to.&nbsp; But after a certain period of time, you have a code base that bears almost no resemblance to the old one, but contains exactly the same well-tested functionality, and if you are even a little bit careful, no new bugs.&nbsp; For Joel this process took two weeks.&nbsp; For Netscape 4.x I can imagine it might have taken a bit longer, but not 3 years!<br /></p>[/quote]<div><br class="khtml-block-placeholder" /></div><div>Nice theory.&nbsp; I&#39;m currently working on a code library that, sooner or later, is going to need to be re-written from the ground up.&nbsp; It&#39;s a cross-platform compatibility library, designed around the limitations of Windows 3.1 and Macintosh System 6.&nbsp; The memory allocation system is based around allocations of 64KB or less, the polling-based main event loop is incompatible with the MacOSX system of registering event callbacks, and the file-access sytem is based around the assumption of 8.3 filenames.&nbsp; There&#39;s leftover code from the days when this library supported things like VAX VMS, or a windowed application in a character-based display, and code for handling both ASCII and EBCDIC.</div><div><br class="khtml-block-placeholder" /></div><div>Further, the whole thing is written in object-oriented C, with all the fun that entails, and it&#39;s optimized for code size, not maintainability.</div>
  • KattMan 2006-09-15 16:47
    <p>Yes, both of these are theories.&nbsp; Which one is more appropraite depends on the situation.&nbsp; I have encountered situations where cleaning up an existing code base was the right way to go and also times when trashing the current and starting over was right.</p><p>Regretfully I can&#39;t say I have always made the right decision the first time.&nbsp; With this in mind, you never delete your old code until your new fully written version is completed.&nbsp; You never know when you may need to fix a mission critical issue in the old code while it is still in production.</p>
  • meow 2006-09-15 17:15
    <p>... my roomate likes aol!</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>... (maybe &quot;report abuse&quot; would&#39;ve been the better button to click)....<br /></p>
  • cconroy 2006-09-15 17:18
    [quote user=&quot;Anonymous&quot;]<div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div><p>[/quote]</p><p>Let me guess: You were designing the official web site of Leisure Suit Larry 4?&nbsp;</p>
  • biziclop 2006-09-15 17:24
    [quote user=&quot;VGR&quot;][quote user=&quot;Anonymous&quot;]
    <p>Netscape&#39;s history is full of WTFs.</p>
    <p>Throwing away the release 4 code is one - that was working and
    tested code, even if full of bloat. See http://joelonsoftware.com/ -
    the guy explains it much better. </p>
    <p>[/quote]</p>
    <p>I knew someone was going to bring up Joel&#39;s &quot;never throw away the code&quot; article.</p>
    <p>Joel is dead wrong and so are you.&nbsp; In fact I recommend reading <a href="http://www.laputan.org/mud/">The Big Ball of Mud</a>,
    as it&#39;s far more insightful and sheds light on the unfortunate and
    seemingly inevitable cycle of code becoming so bloated and tangled that
    it has to be thrown away, because it reaches a point where over 99% of
    developers&#39; time is spent on maintenance or just plain scratching their
    heads.&nbsp; (I firmly believe it is possible to *not* end up having
    throw away a codebase, even after decades, but it requires much more
    diligence and skill than most programmers are willing to exercise, and
    it requires a manager with a clue where software development is
    concerned.)</p><p>I&#39;m especially surprised that anyone still stands
    behind Joel&#39;s article, considering the success of Mozilla and the fact
    that it&#39;s brought an excellent browser to so many platforms.&nbsp;
    Looking back, throwing away the Netscape 4.x code seems like the best
    thing that&#39;s ever happened to the browser world.<br />
    &nbsp;</p><p>[/quote]</p><p>I don&#39;t feel myself clever enough to give general advice to everyone lkie &quot;don&#39;t throw away your code&quot; or &quot;goto is evil&quot; but I know one thing from my own experience. On numerous occasions I accidentally or deliberately threw away some pieces of code I had written and opted to rewrite it. The result, compared to the original one was always much better. I really don&#39;t know why, I suppose it was because I vaguely remembered the major pitfalls but forgot how I evaded them, but that&#39;s only a theory.<br /> </p>
  • biziclop 2006-09-15 17:34
    [quote user=&quot;Anonymous&quot;]<p>Yes, both of these are theories.&nbsp; Which one is more appropraite depends on the situation.&nbsp; I have encountered situations where cleaning up an existing code base was the right way to go and also times when trashing the current and starting over was right.</p><p>Regretfully I can&#39;t say I have always made the right decision the first time.&nbsp; With this in mind, you never delete your old code until your new fully written version is completed.&nbsp; You never know when you may need to fix a mission critical issue in the old code while it is still in production.</p><p>[/quote]</p><p>To throw out a horribly messed up project or to stick with it and try to mend it is perhaps the most complicated and delicate decision a manager has to make in this industry. That&#39;s why ithe wrong way is chosen so many times. Because if management has a clue, the project doesn&#39;t get messed up to the extent to force this decision.<br /></p>
  • csi235 2006-09-15 17:35
    <p>[quote user=&quot;Alex Papadimoulis&quot;]A Netscape engineer who shan&#39;t be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30[/quote]</p><p>&nbsp;</p><p>32. My brain reformatted itself upon seeing this. It just couldn&#39;t handle it.<br /></p>
  • nobody 2006-09-15 17:58
    [quote user=&quot;Anonymous&quot;]They should have put Paula in charge of that. :)<br />[/quote]<br /><br />But that wasn&#39;t possible because she was bussy with the ActiveX sand-boxing code for IE.<br />
  • biziclop 2006-09-15 18:03
    [quote user=&quot;VGR&quot;][quote user=&quot;Anonymous&quot;]
    <p>Netscape&#39;s history is full of WTFs.</p>
    <p>Throwing away the release 4 code is one - that was working and
    tested code, even if full of bloat. See http://joelonsoftware.com/ -
    the guy explains it much better. </p>
    <p>[/quote]</p>
    <p>I knew someone was going to bring up Joel&#39;s &quot;never throw away the code&quot; article.</p>
    <p>Joel is dead wrong and so are you.&nbsp; In fact I recommend reading <a href="http://www.laputan.org/mud/">The Big Ball of Mud</a>,
    as it&#39;s far more insightful and sheds light on the unfortunate and
    seemingly inevitable cycle of code becoming so bloated and tangled that
    it has to be thrown away, because it reaches a point where over 99% of
    developers&#39; time is spent on maintenance or just plain scratching their
    heads.&nbsp; (I firmly believe it is possible to *not* end up having
    throw away a codebase, even after decades, but it requires much more
    diligence and skill than most programmers are willing to exercise, and
    it requires a manager with a clue where software development is
    concerned.)</p><p>I&#39;m especially surprised that anyone still stands
    behind Joel&#39;s article, considering the success of Mozilla and the fact
    that it&#39;s brought an excellent browser to so many platforms.&nbsp;
    Looking back, throwing away the Netscape 4.x code seems like the best
    thing that&#39;s ever happened to the browser world.<br />
    &nbsp;</p><p>[/quote]</p><p>This article should be taught at every university!</p><p>Just the other day I tried to explain to a coworker Conway&#39;s Law (without actually knowing that it was Conway&#39;s) in an argument about whether to tear down a layer in our product. It originally represented an organizational border but as the front lines have shifted since, now it&#39;s only an abandoned trench strewn with loose bits of barbed wire and land mines.<br /></p>
  • Charlie 2006-09-15 18:03
    A fascinating and hilarious post!&nbsp; Thanks very much for posting this - it&#39;s really made my day.<br />
  • SomeCoder 2006-09-15 18:16
    [quote user=&quot;<strong>biziclop</strong>&quot;] <p>This article should be taught at every university!</p><p>Just the other day I tried to explain to a coworker Conway&#39;s Law (without actually knowing that it was Conway&#39;s) in an argument about whether to tear down a layer in our product. It originally represented an organizational border but as the front lines have shifted since, now it&#39;s only an abandoned trench strewn with loose bits of barbed wire and land mines.<br /></p><p>[/quote]</p><p>&nbsp;</p><p>Do you mean the Big Ball of Mud article?&nbsp; It was taught at my university.&nbsp; I had to read that entire page and write a short paper about it.&nbsp; This was in my Software Engineering 1 class. *shrug*</p><p>&nbsp;As for putting a C class pointer into JAVASCRIPT..... Putting it into a string may be supported but a JAVASCRIPT string?&nbsp; I think I&#39;m now dumber having heard that...</p>
  • Anon Coder 2006-09-15 18:52
    <p>[quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2. The real WTF is that some people still haven&#39;t memorized every single word of the C specification. Geez.

    (Prolepsis: Of course I agree pointer-&gt;string-&gt;pointer is not a Good Idea.)[/quote]</p><p>Having looked at Firefox&#39;s source code, I doubt that&#39;s what happened.&nbsp; I expect it&#39;s more along the lines of a simple (char*) cast.&nbsp; Mozilla has something like three or four different ways of storing strings.&nbsp; One of them is a single-byte ASCII string with an int length.&nbsp; I think.&nbsp; Using that, you could directly pass JavaScript a pointer as a four &quot;character&quot; string.&nbsp; (Or whatever the pointer size on the platform is.)</p><p>Assuming the string is never modified, the bytes will remain intact.</p><p>The only real public example of something similar I can think of is <a href="http://www.xulplanet.com/references/xpcomref/ifaces/nsICryptoHash.html">nsICryptoHash</a>.&nbsp; The finish method takes a bool, causing it to either return a base-64 encoded hash, or a &quot;string&quot; of bytes.</p><p>Mozilla&#39;s <a href="http://developer.mozilla.org/en/docs/XPCOM:Strings">string library</a> takes a bit of getting used to.&nbsp; It&#39;s not bad, necessarily, but it&#39;s complicated and can be confusing.<br /></p>
  • foxyshadis 2006-09-15 18:54
    [quote user=&quot;csi235&quot;]<p>[quote user=&quot;Alex Papadimoulis&quot;]A Netscape engineer who shan&#39;t be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30[/quote]</p><p>&nbsp;</p><p>32. My brain reformatted itself upon seeing this. It just couldn&#39;t handle it.<br /></p><p>[/quote]</p><p>It&#39;s the newest excuse for interprocess pointer-passing. You&#39;re not passing a pointer! You&#39;re passing a string! That makes it all okay, and means none of the rules about pointers and processes apply. :D</p><p>&nbsp;Really, the best thing about having thrown away the entire clusterfuck-in-a-clusterfuck NS4 codebase, was going on to repeat half the mistakes and create a whole new half to fill the gaps during the mozilla development. It&#39;s still a mess, anything incorporating a half-dozen new technologies invented soley for a single suite would, but at least it&#39;s steadily gone down as over-engineering gets replaced by the newer volunteers.<br /></p>
  • Nandurius 2006-09-15 19:14
    [quote user=&quot;Carnildo&quot;]Nice theory.&nbsp; I&#39;m currently working on a code library that, sooner or later, is going to need to be re-written from the ground up.&nbsp; It&#39;s a cross-platform compatibility library, designed around the limitations of Windows 3.1 and Macintosh System 6.&nbsp; The memory allocation system is based around allocations of 64KB or less, the polling-based main event loop is incompatible with the MacOSX system of registering event callbacks, and the file-access sytem is based around the assumption of 8.3 filenames.&nbsp; There&#39;s leftover code from the days when this library supported things like VAX VMS, or a windowed application in a character-based display, and code for handling both ASCII and EBCDIC.<div><br class="khtml-block-placeholder" /></div><div>Further, the whole thing is written in object-oriented C, with all the fun that entails, and it&#39;s optimized for code size, not maintainability.[/quote]</div><div>&nbsp;</div><div>Well, I just heard about the theory myself, and it doesn&#39;t seem unreasonable. If I had the your codebase handed to me, I might want to rewrite it too, and I might actually do that it if nobody stopped me.</div><div>Maybe you CAN actually refactor and clean up the code instead of simply rewriting it. </div><div>Does the library work NOW, on todays systems? Why break it. You can have a field day tearing out everything related to windows 3.11, MacOs and VMS until only the bare essentials are left. Now increase the buffer sizes, adapt the model to more modern APIs, and add documentation as needed.</div><div>&nbsp;</div><div>You can probably delete faster than you can rewrite. I think it&#39;s worth a try at least.&nbsp;</div><div>&nbsp;</div>
  • Olddog 2006-09-15 19:17
    <p>This is a slight stretch off topic but I&#39;ll try to show the relevance.&nbsp; In an article today on MSNBC.com, A U.S. judge ordered a U.K. based company, an international anti-spam organization that creates blacklists, to pay $11.7 million in damages to a U.S. direct e-mail marketing company, because it hurt the marketing company&#39;s ability to do business.</p><p>What scares me is that this might become an argument for web advertisers ( popup ads ) using the same argument against popup blocking. Has anyone run across any articles concerning popup blocking legality?</p>
  • brinke 2006-09-15 22:59
    great article.&nbsp; but what IS the ULTIMATE WTF.&nbsp; did i miss it?
  • jimmajamma 2006-09-16 01:09
    <p>I&#39;ll reduce the setup as I could go on for days...</p><p>Its the early days of the browser wars and JS and Java, I think NS 4.x.&nbsp;</p><p>I was tasked to do a feasibility study for a java applet being used as a data connector back to the webserver that JavaScript could use (since js couldnt get to the server without a page refresh) - funny enough the concept is just like the basis of our new latest and greatest browser tech - Ajax. </p><p>1. I got an applet running in a page, I exposed a public method to JS, and added the appropraite tag - I think RUNSCRIPT on the applet tag.</p><p>2. I created a button and some JS to call the function on the applet.</p><p>3. I knew from prior apps that I could write a java applet that connected back to the server - no brainer.<br /></p><p>Now, since 1 and 2 worked and 3 worked independently - I &quot;ASSUMED&quot; (my mistake) that 1, 2 and 3 would work in conjunction - reasonable assumption I thought.<br /></p><p>Great - feasibility study done, I reported the affirmative results, it definitely seemed like it would work - I did everything short of actually writing the whole thing.&nbsp; Come game day, I actually hook it all together, I press the HTML button, it fires the JS, it calls the Applet - guess what?&nbsp; Error box: something along the lines of &quot;Java cannot initiate a network call form JavaScript - Yet.&quot;</p><p>&quot;YET&quot;, I love that one - &quot;Yet&quot;.&nbsp; That&#39;s really helpful.&nbsp; And it screwed me an dmade me look like an incompentent.&nbsp; BTW, at the time, IE performed the task perfectly - much has changed since then of course...</p><p>This is just the most prominent of a boat load of things like this that I ran into using Netscape back in the day.&nbsp; That said, IMHO, Firefox kicks butt these days as the web development platform of choice.&nbsp; </p><p>Thanks for the memories.<br /><br /><br />&nbsp;</p>
  • me 2006-09-16 02:44
    [quote user=&quot;Anonymous&quot;]<p>This is a slight stretch off topic but I&#39;ll try to show the relevance.&nbsp; In an article today on MSNBC.com, A U.S. judge ordered a U.K. based company, an international anti-spam organization that creates blacklists, to pay $11.7 million in damages to a U.S. direct e-mail marketing company, because it hurt the marketing company&#39;s ability to do business.</p><p>What scares me is that this might become an argument for web advertisers ( popup ads ) using the same argument against popup blocking. Has anyone run across any articles concerning popup blocking legality?</p>[/quote]<br /><br />If I&#39;m running HTML code on my computer, I get to choose how to run it. A blacklist is different.<br />
  • Garo 2006-09-16 03:40
    <p>This is one of the best writed WTF what I have had a change to read here!</p><p><br />- Garo&nbsp;</p>
  • biziclop 2006-09-16 03:45
    [quote user=&quot;Anonymous&quot;]<p>I&#39;ll reduce the setup as I could go on for days...</p><p>Its the early days of the browser wars and JS and Java, I think NS 4.x.&nbsp;</p><p>I was tasked to do a feasibility study for a java applet being used as a data connector back to the webserver that JavaScript could use (since js couldnt get to the server without a page refresh) - funny enough the concept is just like the basis of our new latest and greatest browser tech - Ajax. </p><p>1. I got an applet running in a page, I exposed a public method to JS, and added the appropraite tag - I think RUNSCRIPT on the applet tag.</p><p>2. I created a button and some JS to call the function on the applet.</p><p>3. I knew from prior apps that I could write a java applet that connected back to the server - no brainer.<br /></p><p>Now, since 1 and 2 worked and 3 worked independently - I &quot;ASSUMED&quot; (my mistake) that 1, 2 and 3 would work in conjunction - reasonable assumption I thought.<br /></p><p>Great - feasibility study done, I reported the affirmative results, it definitely seemed like it would work - I did everything short of actually writing the whole thing.&nbsp; Come game day, I actually hook it all together, I press the HTML button, it fires the JS, it calls the Applet - guess what?&nbsp; Error box: something along the lines of &quot;Java cannot initiate a network call form JavaScript - Yet.&quot;</p><p>&quot;YET&quot;, I love that one - &quot;Yet&quot;.&nbsp; That&#39;s really helpful.&nbsp; And it screwed me an dmade me look like an incompentent.&nbsp; BTW, at the time, IE performed the task perfectly - much has changed since then of course...</p><p>This is just the most prominent of a boat load of things like this that I ran into using Netscape back in the day.&nbsp; That said, IMHO, Firefox kicks butt these days as the web development platform of choice.&nbsp; </p><p>Thanks for the memories.<br /><br /><br /></p><p>[/quote]</p><p>Well, at least this worked unerd IE. :)</p><p>(You might have been able to fool NS if you just copied the parameters into your applet and had another thread do the http call.)&nbsp;</p>
  • ammoQ 2006-09-16 05:49
    <p>[quote user=&quot;Anonymous&quot;]<br />If I&#39;m running HTML code on my computer, I get to choose how to run it. A blacklist is different.<br />[/quote]</p><p>Why? It&#39;s also my decision whether or not to use a blacklist for spam filtering. BTW, popup advertising has at least the positive effect of funding the website I&#39;m using,</p><p>while spam is only annoying.<br />&nbsp;</p>
  • jimmajamma 2006-09-16 12:04
    <p>VGR, I back your sentiments 100%.&nbsp; At a certain point the code becomes almost secondary to the evolved design, which is what contains the real value.&nbsp; Once code gets to a certain point, in many cases, a project should just get rearchitected.&nbsp; I&#39;m a big proponent of starting with a fresh project, and carefully moving existing code into it - more like a porting process (to a different language) than anything else - port to the new architecture.&nbsp; I believe this is the single biggest reason that many projects fail (of all sorts - I&#39;ve seen many consulting projects either die this way, or get saved from the brink by just the process I&#39;m mentioning).&nbsp; The old netscape is a clear example of this, and your point about Mozilla is perfect - look how great a product we can get when the code is scrapped but the ideas move forward.&nbsp; No offense to Netscape lovers, it was a huge POS - the programmability back then was just attrocious.&nbsp; I posted another response here with a story about one of my more painful netscape experiences...<br /></p><p>One last thing, related to this idea, and I think this is a great example, and man I wish the idiot architect who caused this problem would read this...&nbsp; I worked at Lotus consulting for a few years.&nbsp; They were working on this project to scan large volumes of content into Notes Databases.&nbsp; The original team consisted of an architect and 5 developers, they took between 6 months and a year to architect and write the code for this monstrous overthreaded design that could achieve max 60 documents per minute.&nbsp; The executable was gigantic, and maintenance was a pain in the balls.&nbsp; A friend of mine tasked with seeing if he could improve the project, in one weekend mind you, rewrote the heart of the application and improved the perfomance close to tenfold.&nbsp; He ultimately reduced the footprint by some huge factor - from something like 60 meg to 6, and as you could imagine it reduced the code size as well, and therefore the understandability and maintainability of the code.&nbsp; </p><p>He had the benefit of really understanding everything the code needed to do, so he was able to storm right at that target instead of over architecting something that might have needed to be something else - that was his one true advantage.&nbsp; It didn&#39;t hurt that the original architect had a huge superiority complex and was full of himself.&nbsp; But just imagine that - from 6 months with a full team, to a weekend with one good developer, and the output was so much better...<br />&nbsp;</p>
  • jimmajamma 2006-09-16 12:10
    I think I researched that, but the problem then was how to get the results back to JS.&nbsp; My memory is foggy, but I don&#39;t think the DOM was developed enough back then to do the things we needed, and that obviously can do today with Ajax technology.&nbsp; Also, I think at the least performance was pretty important, we were counting in 10ths of seconds in terms of performance - so any extra delay was bad.&nbsp; Its funny, back when the web was &quot;new&quot; and people were converting/comparing their client/server process to the web, the delay was a huge deal - now it seems secondary - so even if the web version is slower, the other benefits clearly outweigh the disavantages of slow page refreshes...<br />
  • Mick Horan 2006-09-16 12:15
    <p>Hi Blake,</p><p>WOW cofounder of Firefox I hope I can pick your brain with a Firefox question.</p><p>I have a Dell 5100 system running Microsoft Windows XP Professional, Media Center.</p><p>I&#39;ve tried several times to Install and run Firefox (most recently yesterday) without success.</p><p>It goes through the install and seems to be intalling fine until it looks like it is doing some sort of search for files and never ends.</p><p>I just know ried to load and run Firefox and it just says it&#39;s loading.</p><p>Is there a compapatibility problem between Firefox on The Media Center?</p><p>Thanks for the help.</p><p>Mick&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
  • Anonymous 2006-09-16 13:31
    [quote user="Anonymous"][quote user=&quot;byte_lancer&quot;]We really want to know more about this 30 part. <p>Did it kill 30 processes (WTF) ? or threads ? or connections ?[/quote]</p><p>Pleeeeease tell me&nbsp;that&#39;s sarcasm.&nbsp; It&#39;s a news-story-like phrase, like &quot;hurricane&nbsp;damages AOL headquarters, killing 30.&quot;</p><p>&nbsp;[/quote]

    Actually, this is what happened:
    [quote]
    Engineer 1: You bloody did what?<p>
    Engineer 2: It's brilliant actually. I pass that pointer to JavaScript as string and...<p>
    Engineer 1: You didn't... Tell me you didn't!<p>
    Engineer 2: Yes I did, and it's spelled out in black and white in ISO 9899-1999:TC2. <p>
    Engineer 1: What? (dumbfound)<p>
    Engineer 2: Some people still haven't memorized every single word of the C specification...<p>
    Engineer 1: You're fired!<p>
    [/quote]

    ... Next day...
    Engineer 2: (Holding an Uzi in both hand, dressed like Rambo) *tatatatatatatatat*

    ...Evening News...
    "Today, 30 marketing employees at AOL was shot down by an engineer, witnesses claimed that the engineer was screaming "ISO 9899-1999:TC2!" all the time he was mowing down the victims."
  • voyager 2006-09-16 13:42
    [quote user=&quot;Belcat&quot;]<p>You forgot the other big WTF: Netscape 6.&nbsp; Releasing a browser that could barely work was a real WTF and probably cost them whatever was left of their Netscape fans...</p><p>&nbsp;</p><p>[/quote]

    </p><p>Couldn&#39;t agree more. I was a massive Netscape fan-boy. I the days of Netscape 3 and IE 3 I became hooked on Netscape and just couldn&#39;t imagine why any fool would run IE above Netscape. Then came NS 4.75 Communicator and my faith waivered but I stuck with Netscape, then came the dissaster that was NS 6. It was slow, it was buggy and it messed up even simple sites (including the first site I ever got paid money to build!). That was it, I switched to IE and didn&#39;t look back till someone gave me a copy of FireBird 0.7. I never looked back and I&#39;ll be first in line for the new FireFox 2 when it comes out. It never ceases to amaze me that Netscrape still exists. Who still uses it?</p><p>Bart.&nbsp;</p>
  • Chad Austin 2006-09-16 14:28
    <p>I was one of the last interns at Netscape, I think around the time that Blake started working there in person.&nbsp; I had just finished by sophomore year in college and was like &quot;Yeah!&nbsp; Silicon valley!&nbsp; Netscape!&nbsp; This is cool!&quot;&nbsp; But things didn&#39;t quite add up...&nbsp; only one person on the rendering team was left, there were none or few automated tests (so just about every release regressed in some way), and the code review process was so slow and draconian it&#39;s amazing _anything_ happened.<br /><br />So, I was hired as a QA guy, but only because the original engineering spot I applied for had been filled.&nbsp; Nonetheless, I was given time to do software development on the side.&nbsp; So I decided I&#39;d fix a relatively simple bug that had been around for quite a while.&nbsp; It took _two months_ to get through the review and super reviewer process.&nbsp; (Which was also the primary way knowledge transfer was accomplished, btw.)<br /></p><p>Now I work at a startup where if your change passes the tests, it&#39;s a go.&nbsp; As long as you&#39;ve added new tests for the missing functionality, anyway.&nbsp; And knowledge transfer is accomplished by pair programming.&nbsp; Now I can look back at my Netscape summer with a great big, educational WTF.<br /></p><p>p.s. SWIG (Simplified Wrapper and Interface Generator) stores C pointers in strings in some (all?) scripting language implementations.<br /></p><p>&nbsp;</p>
  • Nick 2006-09-16 16:08
    [quote user=&quot;Anonymous&quot;]<p>&gt; a Netscape engineer who shan&#39;t be named once passed a pointer to
    JavaScript, stored it as a string</p><p> &gt; and later passed it back to C,
    killing 30</p><p>&nbsp;31, my brain dropped core and I can&#39;t get it to reboot. <br />
    </p><p>[/quote]</p><p>&nbsp;</p><p>How about a WIN32 client (which could be on a remote machine from the server)</p><p>Taking a HWND, serializing it into a CArchive object. Converting that to a &quot;CBlob&quot;</p><p>*sending it over the network to the server* </p><p>Eventually the server sends it back (via the same mechanism).</p><p>&nbsp;</p><p>The client decodes it, and uses the handle to find the &quot;correct&quot; window to display the results in.</p><p>&nbsp;</p>
  • Nick 2006-09-16 16:19
    [quote user=&quot;Carnildo&quot;][quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2.[/quote]<div><br class="khtml-block-placeholder" /></div><div>Yes, but does the spec say anything about what should happen if that string is passed through a Javascript applet?&nbsp; I&#39;m fairly sure that&#39;s undefined behavior.</div><p>[/quote]</p><p>&nbsp;</p><p>Spec also doesn&#39;t necessarily say &quot;it&#39;s a good idea&quot; -- how they heck are you supposed to check the pointer is good when you get it back in a reasonable manner?&nbsp;</p>
  • anonymous 2006-09-17 07:17
    [quote user=&quot;Anonymous&quot;]<p>&nbsp;How about a WIN32 client (which could be on a remote machine from the server)</p><p>Taking a HWND, serializing it into a CArchive object. Converting that to a &quot;CBlob&quot;</p><p>*sending it over the network to the server* </p><p>Eventually the server sends it back (via the same mechanism).</p><p>&nbsp;<br />The client decodes it, and uses the handle to find the &quot;correct&quot; window to display the results in.[/quote]</p><p>The ultimate multiplayer internet game will be a FPS where the screen is rendered on the server, and send to the client trough a VNC alike conexion.&nbsp; Nowdays theres not enough bandwith even to implement its as &quot;lets check this bad idea&quot;, but in 2/3 years will be doable.<br /></p><p>&nbsp;</p>
  • Alexis de Torquemada 2006-09-17 12:45
    <p>[quote user=&quot;stevekj&quot;]I don&#39;t think you quite got the point of Joel&#39;s article.&nbsp; It wasn&#39;t that code never has to be rehashed, sometimes extensively.&nbsp; As you and Joel both know, it does.&nbsp; The point is that throwing everything out and starting from scratch is the wrong way to go about that, especially if you want to be commercially successful.&nbsp; The correct and commercially successful way to rehash your code is to do it a bit at a time, moving this here, moving that there, untangling this knot, sweeping all the lint away from that other ball of mud over there, and at each step your code still does exactly what it did before, and you can still ship it if you have to.[/quote]</p><p>This might have the advantage that you always have a releasable product, but it can make matters <strong>much</strong> more complicated. For example basic maintainability features such as component-based architecture, design by contract, separation of concerns etc. are not easily available as an afterthought and implementing them into a tangled mess of spaghetti code will typically involve much more and much harder work than redoing the architecture from scratch. I learned this the hard way when I tried to make a Windows GUI port of a relatively small(!) DOS application I once wrote that used an ncurses-like library. The problem was that user interface, data processing and internal logic were horribly entangled. I managed through hard and painful work to make a GUI with basic features, but I gave up when I found that implementing the stuff I actually wanted the GUI to do was much harder still. And the code at that time was still a maintenance mess. I easily figured that rewriting the whole thing would be a lot easier, though I never got around to do that. That way I learned the benefits of separation of concerns the easy way. Yes, the easy way, because I was damn lucky to learn this lesson through the failure of such a small one-man project.<br /></p><p>The best thing to do of course is not to write code like this in the first place. But people often don&#39;t know better the first time around, and then the second best thing can very well be to rewrite the application. Period. That does not mean you cannot reuse. Even if you decide to rewrite (or let&#39;s say rearchitect), you can still salvage. You have code that&#39;s known to work and that&#39;s hard to rewrite? Fine - just port it to the new architecture. This approach has the huge advantage that salvaging code is a conscious decision. Every piece of legacy (rsp. prototype) code thus has to pass a sanity filter:</p><ul><li>Does this code work reliably? If not, how expensive is it to make it work?<br /></li><li>Does this code do what we want it to do? If not, how expensive is it to make it do that?</li><li>And how expensive would it be to write a replacement that works and contains all required features?</li></ul><p>It might be argued that it isn&#39;t worth the effort to evaluate every piece of code that way. But code that&#39;s not worth the evaluation effort is easily rewritten anyway. So &quot;Should I even bother to evaluate the costs of reusing this?&quot; will just be the first criterion for reuse, which at least 80% of the code in a badly designed application will fail right away.<br /><br /></p>
  • no name 2006-09-17 19:15
    [quote user=&quot;Alexis de Torquemada&quot;]
    <p>[quote user=&quot;stevekj&quot;]I don&#39;t think you quite got the point of
    Joel&#39;s article.&nbsp; It wasn&#39;t that code never has to be rehashed,
    sometimes extensively.&nbsp; As you and Joel both know, it does.&nbsp;
    The point is that throwing everything out and starting from scratch is
    the wrong way to go about that, especially if you want to be
    commercially successful.&nbsp; The correct and commercially successful
    way to rehash your code is to do it a bit at a time, moving this here,
    moving that there, untangling this knot, sweeping all the lint away
    from that other ball of mud over there, and at each step your code
    still does exactly what it did before, and you can still ship it if you
    have to.[/quote]</p>
    <p>This might have the advantage that you always have a releasable product, but it can make matters <strong>much</strong>
    more complicated. For example basic maintainability features such as
    component-based architecture, design by contract, separation of
    concerns etc. are not easily available as an afterthought and
    implementing them into a tangled mess of spaghetti code will typically
    involve much more and much harder work than redoing the architecture
    from scratch. I learned this the hard way when I tried to make a
    Windows GUI port of a relatively small(!) DOS application I once wrote
    that used an ncurses-like library. The problem was that user interface,
    data processing and internal logic were horribly entangled. I managed
    through hard and painful work to make a GUI with basic features, but I
    gave up when I found that implementing the stuff I actually wanted the
    GUI to do was much harder still. And the code at that time was still a
    maintenance mess. I easily figured that rewriting the whole thing would
    be a lot easier, though I never got around to do that. That way I
    learned the benefits of separation of concerns the easy way. Yes, the
    easy way, because I was damn lucky to learn this lesson through the
    failure of such a small one-man project.<br />
    </p>
    <p>The best thing to do of course is not to write code like this in the
    first place. But people often don&#39;t know better the first time around,
    and then the second best thing can very well be to rewrite the
    application. Period. That does not mean you cannot reuse. Even if you
    decide to rewrite (or let&#39;s say rearchitect), you can still salvage.
    You have code that&#39;s known to work and that&#39;s hard to rewrite? Fine -
    just port it to the new architecture. This approach has the huge
    advantage that salvaging code is a conscious decision. Every piece of
    legacy (rsp. prototype) code thus has to pass a sanity filter:</p>
    <ul>
    <li>Does this code work reliably? If not, how expensive is it to make it work?<br />
    </li>
    <li>Does this code do what we want it to do? If not, how expensive is it to make it do that?</li>
    <li>And how expensive would it be to write a replacement that works and contains all required features?</li>
    </ul>
    <p>It might be argued that it isn&#39;t worth the effort to evaluate every
    piece of code that way. But code that&#39;s not worth the evaluation effort
    is easily rewritten anyway. So &quot;Should I even bother to evaluate the
    costs of reusing this?&quot; will just be the first criterion for reuse,
    which at least 80% of the code in a badly designed application will
    fail right away.<br />
    <br />
    </p>
    [/quote]

    <p>
    Not that I believe the gradual rewrite approach is always the right one, but you missed the idea.
    </p>
    <p>
    In your case you wouldn&#39;t have started writing a Win32 gui. You would
    start with the original DOS app, and work on seperating the gui (tui?)
    from the backend. Once you got to the point where you have properly
    seperated front &amp; back ends - then you would work on replacing the
    DOS front end. That way at any point you could still go back to the old
    front end and do a DOS release (even if the Win32 front end was half
    finished).
    </p>
    <p>Both sides have thier pros and cons (doesn&#39;t everything?). If you go
    for the gradual rewrite, it will (usually) take longer. But at any
    point you can say &quot;good enough for now&quot; and make a release. For
    comercial software (or even internal company software) that can mean
    the difference between life and death for a project. It can even apply
    to open source. Would mozilla have maintained critical mass (i.e.
    enough interested contributers) if AOL/Netscape hadn&#39;t been paying the
    saleries for some of the main developers?
    </p>
    <p>On the other hand, a gradual rewrite can mean rewriting and
    reworking code that you&#39;re just going to throw away at the next stage
    (e.g. rewriting your DOS gui, knowing your going to throw it away in
    the final stage when you actually switch to Win32). A lot of the time
    all that lost work is going to make things longer overall. If the old
    code is really messed up, it can be difficult to find a gradual
    approach that doesn&#39;t just devolve into rewriting everything.
    </p>
    <p>Doing a full rewrite can let you take advantage of lessons learned,
    and perhaps come out with a cleaner design. Just watch out for the
    second system syndrome (we tend to see a lot of that here :-). You also
    need to be sure the project can survive the deadzone until the rewrite
    is good enough for release. I&#39;d recomend taking your worste case
    estimate and multipling by 3.
    </p>
  • Raafschild 2006-09-17 20:07
    [quote user=&quot;Anonymous&quot;][quote user=&quot;Carnildo&quot;][quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2.[/quote]<div><br class="khtml-block-placeholder" /></div><div>Yes, but does the spec say anything about what should happen if that string is passed through a Javascript applet?&nbsp; I&#39;m fairly sure that&#39;s undefined behavior.</div><p>[/quote]</p><p>&nbsp;</p><p>Spec also doesn&#39;t necessarily say &quot;it&#39;s a good idea&quot; -- how they heck are you supposed to check the pointer is good when you get it back in a reasonable manner?&nbsp;</p><p>[/quote]</p><p>&nbsp;</p><p>The important bit is &#39;provided it&#39;s used during the lifetime of the object that it points to&#39;. When the javascript sends the pointer back to the server, it is not guaranteed that it talks to the same process, let alone that the object that the pointer points to is still available.</p><p>.<br />&nbsp;</p>
  • lomaxx 2006-09-17 21:18
    i remember this &quot;feature&quot; in netscape and distinctly remember thinking &quot;hmmm this feature doesn&#39;t work... oh well back to IE&quot;
  • Anonymous 2006-09-17 21:47
    [quote user=&quot;cconroy&quot;][quote user=&quot;Anonymous&quot;] <div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div><p>[/quote]</p><p>Let me guess: You were designing the official web site of Leisure Suit Larry 4?&nbsp;</p><p>[/quote]</p><p>&nbsp;</p><p>I&#39;m not sure if I&#39;m the only one who picked up on this...&nbsp; Absolutely brilliant, I love it.&nbsp; Who knows, maybe Leisure Suit Larry 4 will turn up with&nbsp; Duke Nukem 4 in a distant future.</p>
  • Micael Baerens 2006-09-18 02:16
    &quot;...passed a pointer to JavaScript, stored it as a string and later passed it back to C...&quot;<br /><br />...printed on paper, placed on a wooden table...
  • csrster 2006-09-18 06:58
    [quote user=&quot;Belcat&quot;]<p>You forgot the other big WTF: Netscape 6.&nbsp; Releasing a browser that could barely work was a real WTF and probably cost them whatever was left of their Netscape fans...</p><p>&nbsp;</p><p>[/quote]</p><p>I remember Netscape 6. There was a Netscape 7???</p><p>--</p><p>Colin&nbsp;</p><p>&nbsp;</p>
  • Kiss me, I'm polish 2006-09-18 08:23
    <p>Gotta love those Netscape 8&#39;s huge number of international versions:</p><p>1. Canadian English</p><p>&nbsp;Yes, that&#39;s it. There&#39;s even not a UK build, chaps. And forget 8.1 in other than american English.<br /></p>
  • Charles Perreault 2006-09-18 08:47
    [quote user=&quot;Anonymous&quot;]<div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div><p>[/quote]</p><p>&nbsp;</p><p>At my previous job, I HAD to produce a web application in ASP.NET backward compatible with Netscape 4 Gold... because that&#39;s what ONE of the scientist was using on its sparc workstation (on solaris 5).&nbsp; Just imagine the client side validation code, the CSS and all the little non-working DOM javascript.&nbsp; I truly hate legacy Netscapers.</p><p>&nbsp;</p><p>P.S. Yes Mozilla works on SPARC, but that scientist is still using Netscape 4.</p>
  • ammoQ 2006-09-18 09:04
    [quote user=&quot;Anonymous&quot;][quote user=&quot;Anonymous&quot;]<div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div><p>[/quote]</p><p>&nbsp;</p><p>At my previous job, I HAD to produce a web application in ASP.NET backward compatible with Netscape 4 Gold... because that&#39;s what ONE of the scientist was using on its sparc workstation (on solaris 5).&nbsp; Just imagine the client side validation code, the CSS and all the little non-working DOM javascript.&nbsp; I truly hate legacy Netscapers.</p><p>&nbsp;</p><p>P.S. Yes Mozilla works on SPARC, but that scientist is still using Netscape 4.</p><p>[/quote]</p><p>*lol*, that&#39;s&nbsp; when people like me have a chance to shine. Never learned anything beyond HTML 3.1, so I&#39;m hardly able to make a web app that breaks on Netscape 4.</p><p>&nbsp;</p><p>&nbsp;</p><p>;-)&nbsp;</p><p>&nbsp;</p>
  • Seriema 2006-09-18 09:42
    Oh wow that&#39;s ... incredible! I wtf&#39;d so much my food almost came out my nose! And you&#39;ve got a wonderfull writing style, just thought I&#39;d let you know =)
  • CodeMechanic 2006-09-18 10:10
    <p>You have completely missed Joel&#39;s point, which, in my words,&nbsp;is &quot;A company trying to make a profit cannot afford to simply stop its efforts to enhance its products while it completely re-engineers the current version.&quot; If you are not trying to make a profit or if you have armies of _qualified_ programmers donating their time and skill, perhaps you can get out ahead of the rest of us.</p><p>&nbsp;Of course it is possible to avoid having to throw away a codebase, but, as you point out, it requires diligence, skill and discipline, all of which seem to be in short supply. </p>
  • Captcha: Zork. 2006-09-18 11:41
    <p>What I fail to understand as I work at these businesses is.. How the hell does the Marketing department get away with all of this?&nbsp; </p><p>&nbsp;</p><p>They have no accountability. &nbsp; If sales are low, It&#39;s Sales&#39; fault. &nbsp; If the product doesn&#39;t do what they promise, it&#39;s the developers / production&#39;s fault. Noone ever says &#39;Let&#39;s look at Marketing&#39;s effect on product sales.&#39;</p><p>&nbsp;</p><p>&nbsp;And yet, in every company, marketing is king.&nbsp;&nbsp; If marketing wants something, hop to it.&nbsp;&nbsp; They greenlight projects, and approve everything.<br /></p><p>&nbsp;</p><p>I sware I&#39;m in the wrong line of work.&nbsp;</p>
  • dasmb 2006-09-18 12:26
    <p>Anybody still want to claim that Netscape lost the browser wars because of Microsoft&#39;s monopolistic practices?</p><p>&nbsp;<br /><br />&nbsp;</p>
  • ammoQ 2006-09-18 12:37
    [quote user=&quot;Anonymous&quot;]<p>Anybody still want to claim that Netscape lost the browser wars because of Microsoft&#39;s monopolistic practices?</p><p>[/quote]</p><p>Definitely. MS won the war when IE4 was not much better than NS4. The NS6 desaster happened when MS already had 80+ percent.<br />&nbsp;</p>
  • It's a Feature 2006-09-18 12:43
    <p>[quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior. It&#39;s spelled out in black and white in ISO 9899-1999:TC2. The real WTF is that some people still haven&#39;t memorized every single word of the C specification. Geez. (Prolepsis: Of course I agree pointer-&gt;string-&gt;pointer is not a Good Idea.)[/quote]</p><p>&nbsp;</p><p>WTF???</p><p>&nbsp;</p><p>a pointer, from a server application, converted to a string and passed to <em>Javascript</em> (which runs on a stateless client), then passed back to C (running on the server).&nbsp; Assuming the insanity works, the real danger is that a hacker figures out how stupid you were and changes the pointer in the Javascript to something else--crashing your server, or worse yet, figuring out how to take control of your server.</p>
  • ammoQ 2006-09-18 13:02
    [quote user=&quot;Anonymous&quot;]&nbsp;<p>a pointer, from a server application, converted to a string and passed to <em>Javascript</em> (which runs on a stateless client), then passed back to C (running on the server).&nbsp; Assuming the insanity works, the real danger is that a hacker figures out how stupid you were and changes the pointer in the Javascript to something else--crashing your server, or worse yet, figuring out how to take control of your server.</p><p>[/quote]</p><p>Todays WTF is about a browser, so it&#39;s all client-side. Granted, in most cases, there is a server that delivers content... but the strange conversion is not done on the server. BTW, a browser is not stateless.<br /></p>
  • John Q. Public 2006-09-19 04:18
    <p>I know ex-AOL-employees who have completely changed their tune. One of them, after having an AOL account for 9 years, and working for AOL himslef for some years, is chaning to Comcast, despite that Comcast charges our area an outrageous sum for Internet.<br /></p><p>The lesser of two evils...</p>
  • devdas 2006-09-19 06:15
    [quote user=&quot;Anonymous&quot;]<p>What scares me is that this might become an argument for web advertisers ( popup ads ) using the same argument against popup blocking. Has anyone run across any articles concerning popup blocking legality?</p><p>[/quote]</p><p>&nbsp;</p><p>If I can&#39;t block your popups, I am not going to visit your site. The web is not the Internet, and quite frankly, I don&#39;t see the real value that Javascript and AJAX are adding to the network. That is merely reinventing the wheel.&nbsp;</p>
  • tufty 2006-09-20 03:54

    <p><em>The ultimate multiplayer internet game will be a FPS where the
    screen is rendered on the server, and send to the client trough a VNC
    alike conexion.&nbsp; Nowdays theres not enough bandwith even to implement
    its as &quot;lets check this bad idea&quot;, but in 2/3 years will be doable.</em></p>
    <p>You might want to look into how X11 works, particularly when running on dumb X terminals.<br />
    </p>
  • savar 2006-09-20 12:43
    [quote user=&quot;neven&quot;]<p>Awesome post - best writing I&#39;ve seen on The Daily WTF. Kudos etc.<br />
    </p><p>[/quote]</p><p>&nbsp;</p>Agreed. The WTF content is good, but the
    writing style is excellent. The dry humor kills me. Too bad I was out
    of town and didn&#39;t read this one until just now.
  • Michael Wojcik 2006-09-22 16:26
    [quote user=&quot;Carnildo&quot;][quote user=&quot;Anonymous&quot;]A strictly-conforming C program may convert an object pointer (though not a function pointer) to a string by casting it to void* and formatting it using sprintf with the %p format specifier (provided the receiving buffer is large enough for the output). Such a string may be stored in any suitable medium and later converted back to an object pointer of the original type (via sscanf) and used, provided it&#39;s used during the lifetime of the object that it points to, without invoking undefined behavior.

    It&#39;s spelled out in black and white in ISO 9899-1999:TC2.[/quote]<div><br class="khtml-block-placeholder" /></div><div>Yes, but does the spec say anything about what should happen if that string is passed through a Javascript applet?&nbsp; I&#39;m fairly sure that&#39;s undefined behavior.</div><div>[/quote]<br /></div><p><br />You may be sure, but you&#39;re wrong.&nbsp; As long as the string is recovered unchanged and converted back to a pointer during the lifetime of the object it points to, behavior is defined.&nbsp; That seems pretty clear in my original post above, and it&#39;s quite clear in the standard.&nbsp; There&#39;s no exception in the standard for being &quot;passed through a Javascript applet&quot;.</p><p>You can take the result of %p-formatting, reverse it, encrypt it with AES-128, carve it onto a stone tablet, and bury it at midnight in an undisclosed location; as long as you get the original string back into the program, you can convert it back to a pointer of the appropriate type and dereference it as long as the object is still around.<br /><br />And as I wrote the first time, <em>of course</em> it&#39;s a bad idea.&nbsp; I pointed out it was defined behavior only because the additional irony makes it even funnier: anyone can produce undefined behavior in a C program (and most C programmers do), but it takes skill to write strictly-conforming code that&#39;s still WTF-stupid.&nbsp; (Note that IOCCC tricks often are not strictly-conforming.)</p><p>&nbsp;</p>
  • webdev101 2006-10-16 16:28
    [quote user=&quot;byte_lancer&quot;][quote user=&quot;Alex Papadimoulis&quot;] <p>a Netscape engineer who shan&#39;t be named once passed a pointer to JavaScript, stored it as a string and later passed it back to C, killing 30&nbsp;</p><p>[/quote]</p><p>We really want to know more about this 30 part.</p><p>Did it kill 30 processes (WTF) ? or threads ? or connections ?</p><p>I have a hunch this has got something to do with the string processing functionality in spidermonkey.<br /></p><p>[quote user=&quot;Alex Papadimoulis&quot;]</p><p>To make things right, Netscape quickly released a version 7.01 that included it, but only after renaming it the &quot;popup suppressor&quot; (&quot;popup decongestant&quot; was trademarked). </p><p>[/quote]</p><p>After reading this submission, I think we must trademark the term &quot;WTF suprressor&quot;.</p><p>[/quote]</p><p>&nbsp;</p><p>And &quot;WTFdecongestant&quot;</p>
  • webdev101 2006-10-16 16:31
    [quote user=&quot;Anonymous&quot;] <div>Side WTF:&nbsp; We once had a client that wanted their web site to work with Netscape 5.</div><p>[/quote]</p><p>&nbsp;</p><p>My boss at the last job wanted to make all the site to work with all the browser including NS 5 and lower and not only that he wanted us to use javascript... </p>
  • Brendan Eich 2006-11-12 19:32
    <p>Your hunch about SpiderMonkey is wrong (how could anything to do with JavaScript or an implementation of it *force* a programmer to pass a pointer formatted as a numeric string through script back to C++? WTF! ;-).</p><p>&nbsp;See <strong>http://tinyurl.com/yeyu9p -- look for the PR_snprintf call.</strong><br />&nbsp;</p>
  • skztr 2006-12-08 20:39
    <p>The whole concept of &quot;Popup Blocking&quot; is a WTF. You don&#39;t need to &quot;block&quot; popups. They aren&#39;t somehow &quot;coming at you&quot; from malicious websites. They are on the website. The web browser just needs to not interpret them.</p><p>The idea that popups somehow &quot;get through&quot; sometimes is further WTF. <br /></p><p>- I&#39;m browsing a webpage<br />- If I want another window, I will explicitely request my web browser give me one&nbsp;</p><p>For _ALL_ web browsers, all they need to do to &quot;block popups&quot; is: NOTHING. Just dont support them.<br />It&#39;s like having a &quot;Virus Blocker&quot; seperately coded which has a bunch of logic aimed at circumventing the &quot;takeOverComputer()&quot; function. Wouldnt it be easier to just not have that function in the first place?<br /><br />There is no option in Firefox to DISABLE popups. Just to &quot;block&quot; them (which of course doesnt work)&nbsp;</p>