Forgot your password?
typodupeerror
Bug Programming Software IT

What is the Best Bug-as-a-Feature? 861

Posted by Cliff
from the unexpected-benefits dept.
Bat Country wonders: "The workflow system, at the department I develop for, was hand-coded by my predecessor in a rather short amount of time, resulting in somewhat unreadable code with a number of interesting 'features.' When I took over maintenance of the code base, I started patching bugs and cleaning up the code in preparation for a new set of features. After I was done, I got a pile of complaints about features that had disappeared, which turned out to be caused by the bugs in the code. So, that leads me to ask: what is your favorite bug that you either can't live without or makes your life easier?"
This discussion has been archived. No new comments can be posted.

What is the Best Bug-as-a-Feature?

Comments Filter:
  • The best (Score:5, Funny)

    by Anonymous Coward on Friday March 30, 2007 @01:54PM (#18546189)
    Windows Genuine Advantage
    • Re:The best (Score:5, Funny)

      by TerranFury (726743) on Friday March 30, 2007 @02:03PM (#18546349)

      >Windows Genuine Advantage

      No, that's a feature that acts like a bug. ;-)

    • Perl versus Python (Score:5, Interesting)

      by goombah99 (560566) on Friday March 30, 2007 @02:06PM (#18546427)
      Perl is perhaps one large bug that works so well that it's a great feature. For example in perl when you compare two things you get an answer that is stable no matter what the items are. In python you can't and even when you can the answer is not stable. The order of a sorted list can depend on it's orginal ordering! You cant compare floats to Complex numbers but you can compare strings to complex numbers. Sets are grouped by equality not identity so 4.0 and 4 are the same thing for a set. Which one stays and which one get added to the set depends on the ordering of the lists that were put in the set.
      it's nuts. And the origin of the nutty ness is an obsessive desire not to have default behaviours. Whereas perl is all default behaviours. In the end perl does what you really meant, and python does what you told it.

      in case you think I'm python bashing google what python evangelist david mertz says about python warts.

      • by badfish99 (826052) on Friday March 30, 2007 @02:16PM (#18546613)
        As a mathematician, I'm always surprised by people who think that 4 and 4.0 should not be equal.
        • by zappepcs (820751) on Friday March 30, 2007 @02:21PM (#18546729) Journal

          As a mathematician, I'm always surprised by people who think that 4 and 4.0 should not be equal.
          Well, one is just a number, the other is the SP version identifier that tells you when its safe to upgrade to a new version of windows.
        • by rootofevil (188401) on Friday March 30, 2007 @02:22PM (#18546733) Homepage Journal
          As a programmer, I'm always surprised by mathematicians who think that 4 and 4.0 should be equal.
          • by IMarvinTPA (104941) <IMarvinTPA@NoSPAM.IMarvinTPA.com> on Friday March 30, 2007 @02:33PM (#18546921) Homepage Journal
            As a programmer, I'm amused by both.
            4 and 4.0 are equal by value but not in precision. 4 has one significant digit, while 4.0 has two. This is important because multiplying it by 1200 (which has two significant digits), yields two scientifically different answers. 4*1200 yields 5000 (5 x 10^3) while 4.0*1200 yields 4800 (4.8 x 10^3).

            So, in the end, it depends, just like everything else.

            IMarv
            • by zippthorne (748122) on Friday March 30, 2007 @02:56PM (#18547315) Journal
              As an engineer, I'm also amused.

              4.0 is definitely a 2 sig dig number, but 4 could be 1 sig dig or it could be "exact." You wouldn't say the 2 in 2*pi*r is only one significant digit, would you? Of course not, it would render any precision in pi or r meaningless.

              Also, 1200 could have 2, 4, or be exact depending on the context. It's best to always use a notation that includes the fraction mark for non-exact quantities.
            • by UserGoogol (623581) on Friday March 30, 2007 @03:56PM (#18548233)
              Those filthy engineer types think that numbers are merely an approximation of reality, and thus to them precision is relevant. Whereas mathematicians don't give a shit about reality and just want to work with the numbers, and a number describes itself perfectly. And when they're forced to go into the land of finite precision for whatever reason, they generally don't feel compelled to sully their numbers with that junk, so they represent precision in different ways.
          • Ah, Units (Score:5, Insightful)

            by EgoWumpus (638704) on Friday March 30, 2007 @03:59PM (#18548279)
            As a programmer, and a former student in at least one other math-related discipline, it's clear to me that 4 and 4.0 are equal. But they are not equivalent. Knowing 'Accuracy', 'Precision' and 'Proper Use Of Units' like the back of your hand will help you in any career.
        • by porpnorber (851345) on Friday March 30, 2007 @04:09PM (#18548433)
          As a mathematician (or at least, an ex-mathematician) I am always amazed by mathematicians who forget that 'equality' between distinct domains is introduced (in standard developments) as a mere abuse of notation. Just because there is a canonical injection of Z into (say) Q does not mean that any element of Z is equal to any element of Q in any normal sense.

          Moreover, since 4.0 is a floating point number, it's not even a very helpful abuse of notation to allow 4 and 4.0 to be 'mathematically' equal, since you can demonstrate that mathematically all floats are equal to each other: there's some nonzero epsilon small enough that epsilon + x is 'equal' to x. It is not helpful to then apply normal mathematical reasoning and conclude that all integers are equal - that is, it's nice to maintain some part of a programming language that is actually consistent, and if we're going to use the symbol '=' for both types, it's helpful at least to maintain that these are distinct overloads!

          Really, any programming language for the mathematically savvy would issue a warning whenever you used a floating point type for anything; floating point support is a somewhat lame compromise for hardware compatibility. If on the other hand we had the habit of using constructive real numbers (which, unlike classical real numbers, are implementable), we would, quite rightly, be forced to reconsider the notion of equality globally.
  • 404 (Score:5, Funny)

    by Jordan Catalano (915885) on Friday March 30, 2007 @01:55PM (#18546193) Homepage
    My favorite:

    "404 File Not Found
    The requested URL (askslashdot/07/03/30/0116246.shtml) was not found."


    That little error saved me from having to read a bunch of replies.
  • by antifoidulus (807088) on Friday March 30, 2007 @01:56PM (#18546203) Homepage Journal
    it pops up all sorts of porn pages I never even asked for!
  • Windows? (Score:5, Funny)

    by cmeans (81143) <cmeans&intfar,com> on Friday March 30, 2007 @01:57PM (#18546223) Homepage Journal
    Microsoft keeps trying to clean up their code, and as a result, sometimes, features that SPAMmers etc. are relying on stop working.

  • rm (Score:5, Funny)

    by KillerCow (213458) on Friday March 30, 2007 @01:57PM (#18546227)
    rm * .old
    • Re:rm (Score:4, Funny)

      by alta (1263) on Friday March 30, 2007 @03:07PM (#18547525) Homepage Journal
      I'm guilty of this one once, missplaced space, and I typed 'rm -rf /etc /*.tmp'

      Yes, this was done on my first slackware box. Not sure what version it was exactly, but it was somewhere between 96-98, and i installed by downloading about 15 or so floppies...

      The first command I typed on that box was 'help.' It wasn't.
    • Re:rm (Score:4, Interesting)

      by kalirion (728907) on Friday March 30, 2007 @04:25PM (#18548725)
      touch "*"

      ... now the waiting game
  • by Anonymous Coward on Friday March 30, 2007 @01:58PM (#18546251)
    Great game! Here. [download.com]

    The guy who wrote the Windows version actually allows you to turn it on! Overpay the money lender and your money grows at 10% a month! The bug was in the original Apple 2 version and then subsequent ports, like the one to Palm, removed it.

  • GPOW (Score:4, Funny)

    by SinGunner (911891) on Friday March 30, 2007 @01:58PM (#18546257)
    I remember getting Godly Plate of the Whale in Diablo at the sacrifice of a single potion with the duping bug. I can't think of anything better than that.
  • buffer overflow (Score:5, Insightful)

    by virtualXTC (609488) on Friday March 30, 2007 @01:58PM (#18546261) Homepage
    buffer overflows are great - they allow you to get root on all sorts of devices that some bastard tried to lock you out of.
  • by SirStanley (95545) on Friday March 30, 2007 @01:59PM (#18546265) Homepage
    ncpmount on linux... at least in our configuration... allows us to overwrite files that have "locks" on them by users. It appears to be happy to ignore the locks. I'm guessing this is a bug... because I can't do it with the same user from Windows.

    This allows us to deploy our java Jar's to our Folders on our network where the users launch the app from.

    Yay.
  • by Allicorn (175921) on Friday March 30, 2007 @01:59PM (#18546279) Homepage
    And although, ultimately, its a pain in the arse that they're there at all, when you get get down to the practical day-to-day business of writing/maintaining websites, some of those bugs turn out to be very handy in concocting freaky work-arounds for inconsistencies in the ways that browsers support (or don't support) the standards.

    I'll leave the provision of an exhausitive list to somebody else, but suffice to say if you're looking for a sizeable seam of bugs-which-simultaneously-screw-you-over-and-help- you-out, then there can hardly be a better place to look than Internet Explorer 6.
  • Easy! (Score:5, Funny)

    by carn1fex (613593) on Friday March 30, 2007 @01:59PM (#18546289)
    They screwed up alot of our web-based financial software. If i set the number of items purchased to zero, the whole thing reboots and i get to go home for th
  • by ZiZ (564727) on Friday March 30, 2007 @02:00PM (#18546297) Homepage

    Error

    Nothing for you to see here. Please move along.

    Nothing beats a good dose of pot-kettle interaction.

  • by Kufat (563166) <.kufat. .at. .kufat.net.> on Friday March 30, 2007 @02:00PM (#18546299) Homepage
    The famous undocmented 320x240 VGA video mode, pre-VESA, and other tweaked VGA modes.

    I've heard the 6502 (or, more specifically, RP2A03) had some useful undocumented opcodes. I think they weren't intentional, so they might count.

    On the software side...how about exploitable buffer overflows on the Xbox and PSP to enable execution of arbitrary code?
    • by greed (112493) on Friday March 30, 2007 @02:36PM (#18546973)

      The Rockwell 6502 was a hard-wired processor; there was no "illegal instruction" check. So, any bit-patter you loaded as an instruction would try to do something. Sometimes, because of the internal open-collector busses, you'd get neat "something OR something" that wouldn't normally happen.

      Here's the I'm Feeling Lucky hit on it: 6502 Opcodes [s-direktnet.de].

      Thing is, the results might vary from implementation to implementation. So they might not work usefully on the 6510, which was otherwise a 6502 with an I/O register at $0000-$0001.

  • by thomasdn (800430) on Friday March 30, 2007 @02:01PM (#18546309) Homepage Journal
    Ping of Death (http://insecure.org/sploits/ping-o-death.html) entertained me quite a while :)
  • by jimicus (737525) on Friday March 30, 2007 @02:02PM (#18546339)
    Not a software bug but a design flaw in a car I used to own.

    The Vauxhall Astra Mk.2 (Opel Kadett E) had a design flaw in the steering column. Specifically, the steering column was rather weaker than the steering lock.

    The upshot of it was when some little scrote decided to try and steal my car (this was way before cars were fitted with immobilisers), when he tried to break the steering lock the steering column snapped and the steering wheel came straight off in his hand.
  • Linux (Score:5, Funny)

    by stratjakt (596332) on Friday March 30, 2007 @02:03PM (#18546351) Journal
    It was supposed to be a unix clone, but actually came out useful in the end.
  • by Behrooz (302401) on Friday March 30, 2007 @02:03PM (#18546357)
    "Subscribe to view" webpages that are still visible to users browsing as GoogleBot.
     
      User agent switcher extension [chrispederick.com] + Browse pretending to be GoogleBot = Annoying "register/pay to see me!" pages go away. I have no idea how many sites it works on now, but I think it still gets into a lot of archived newspaper articles and suchlike.

    • by apathy maybe (922212) on Friday March 30, 2007 @02:15PM (#18546591) Homepage Journal
      Personally I use the modify headers extension to do the same thing. But I have "I am not a Googlebot/2.1", rather then the full Googlebot string. But I sometimes come across pages that say something along the lines of "You appear to be pretending to be a major search engine when you are not", for those pages I change the header to "I DIDN'T CLAIM TO BE A MAJOR FUCKING SEARCH ENGINE".

      Of course, both are examples of why you shouldn't use "User-Agent" to try and detect what browser or bot is using your webpage. The first allows "illegitimate" users access, and the second blocks legitimate users.

      In fact, you shouldn't trust headers for anything unless you have a secure session. To control access to your webpage to robots, use ROBOTS.TXT or a meta tag, and to control access to other users, password protect. But the trouble is that sites are trying to eat their cake (be crawled and indexed) and have it too (control access to ordinary users).
  • by Manatra (948767) on Friday March 30, 2007 @02:04PM (#18546385)
    For me, the physics bug that enabled "skiing" in Starsiege: Tribes was the best bug as a feature. It's a bug that became a key defining point of the series.

    A description of skiing is here [wikipedia.org].
  • by EWIPlayer (881908) on Friday March 30, 2007 @02:06PM (#18546413)
    Sendmail
  • by Headcase88 (828620) on Friday March 30, 2007 @02:07PM (#18546437) Journal
    This barely qualifies as bug, more on an inconsistency, but...

    In Firefox, when you make a new bookmark, you need to give it a name. FF grays-out the OK button until you do. This implies that bookmarks weren't meant to be nameless. Here's the "bug": if you go to rename the bookmark, you can make it blank and the OK button remains active.

    So what good is a nameless bookmark? I place all of my frequently-visited bookmarks on the menu bar, to the right of the menus (it's normally wasted space). I have over 25 bookmarks marks there, and if they had names (even one-letter names), they wouldn't fit by a long-shot. The favicons are all I need, so this ability is pretty helpful, and isn't likely to be fixed.
  • Second Life camera (Score:5, Informative)

    by LinuxHam (52232) on Friday March 30, 2007 @02:07PM (#18546449) Homepage Journal
    In Second Life, if you zoom your camera up to a wall, you will normally just zoom in to see closer detail of the wall. But once up against the wall, swing the camera around to the side, and you can "back your way in" through the wall. Release and click again, and the camera is now "mounted" inside the house. Its so much fun to watch people inside their homes, especially when your avatar is prevented from entering the property. Some even pay for a little orb that still tells them that no one is detected within 30m. Its fun because the clicks still work, too, like right clicking on someone and IM'ing them.. to tell them that you liked their last outfit more than this one, or the couch looked better in the other corner.. really freaks them out. That is definitely a "bug" (or feature) I couldn't live without... not in SL at least.
  • by Ancient_Hacker (751168) on Friday March 30, 2007 @02:09PM (#18546491)
    There were two oversights in the older VW's electrical system:

    (1) You needed the key to close the sunroof.

    (2) But.. a sneak path in the headlight wiring meant you could instead just turn on the headlights and pull on the high-beam flasher (on the turn-signal lever). Enough electricity would flow backwards through the sneak path to operate the sunroof motor. ... ooops, that's more hardware than software. sorry.
  • by mmell (832646) <mmell@hotmail.com> on Friday March 30, 2007 @02:11PM (#18546509)
    More than once, I've rescued SUN servers where somebody hosed up PAM (or even /etc/passwd /etc/shadow) by breaking in this way.

    A related "bug" is the ability to boot Linux "fail safe" with the notation 'initrd=/bin/sh' on the boot line. As MVS would say, "Thou art God!"

  • by foxtrot (14140) on Friday March 30, 2007 @02:12PM (#18546539)
    From the Blue Sky Rangers website [intellivisionlives.com]:

    FUN FACT: While testing the game, Bill came across a bug: every now and then, the game would, seemingly at random, hyperspace you. He and his boss, Mike Minkoff, went over the code with a fine-tooth comb before realizing what the problem was: the Intellivision hand controllers encode button presses in such a way that an action (side) key pressed at the same time as particular directions on the disc will be interpreted instead as a numeric key being pressed. There was no software way around this; shooting while moving would occasionally be interpreted as pressing 9 -- the hyperspace button.

    After several days of puzzling over a solution, the bug was ultimately "fixed" by including the following note in the instruction manual:

    "Every once in a while, your space hunter will move near a 'black hole,' and the computer will automatically put him into HYPERSPACE. This will cost you the same number of points as if you had pressed the HYPERSPACE key yourself. On the other hand, it will save your hunter."

    This led to an axiom frequently heard around Mattel: If you document it, it's not a bug -- it's a feature. Anytime a game in development crashed -- no matter how badly or bizarrely -- witnesses would invariably turn to the frustrated programmer, shrug, and calmly say "document it."


    -JDF
  • by pak9rabid (1011935) on Friday March 30, 2007 @02:13PM (#18546547)
    I'd have to go with strafe jumping in Quake2. What better way to get the 100 health pack in q2dm1 w/out having to sacrifice precious life w/a rocket jump. w00t!
  • I dunno (Score:5, Interesting)

    by Chris Burke (6130) on Friday March 30, 2007 @02:13PM (#18546549) Homepage
    In high school I wrote a program for a physics project that showed electromagnetic wave propagation and interference. Nothing that special, the end result was basically a pretty screensaver with some relevence to physics. In light of that, one of the features I added was a pull-down menu for selecting what color you wanted to use. This was back in the VGA days with a 256 color pallette and manually poking the VGA frame buffer. Due to an off-by-one error in calculating the bounding box of the pull down menu, it was possible to select an invalid index for the color, so instead of selecting a row of the pallette with my nice color gradients set up, it was one of basically random colors. The result was really trippy, so when I discovered the bug, I decided to leave it in. At the open house where my program was running through a projector some bystander discovered the bug and thought it was indeed cool and trippy.

    That's about it. Most of my bugs just break shit. :)
    • Re:I dunno (Score:4, Interesting)

      by soft_guy (534437) on Friday March 30, 2007 @02:29PM (#18546855)
      I hope someone mods this up because it is like the only post for the entire article that is actually relevant or interesting.
    • Re:I dunno (Score:5, Interesting)

      by DedWisdom (1081989) on Friday March 30, 2007 @02:48PM (#18547199)
      I had a similar experience when I was younger. I was learning C++ graphics programing on windows (95), and I was trying to simply make a static screen that showed a monochrome random gradient. Well I had some bug in my algorithm, and the screen went crazy, showing this massive arch with these beautiful repeating patterns within the arc, but random static outside of the arc. Okay, weird, changed some +s and some -s, and got it working, fine.

      Years later I started learning about chaos theory and fractals, and something in my head clicked. I instantly had a vivid memory of that bugged screen and realized that it was a fractal. I had accidentally created a rather complex fractal. Blew my mind clean up.
    • Re:I dunno (Score:4, Funny)

      by Elbows (208758) on Friday March 30, 2007 @03:34PM (#18547941)
      My company writes effects plug-ins for film/video post-production, and a while back we got an email from one of our customers with a similar story. He had been playing around with our effects trying to simulate a look of noisy or damaged video. Suddenly his render failed with an "out of memory" error, and the screen filled with random digital garbage -- it was exactly what he wanted!

      So he rendered it out the way it was, and we gained another happy customer. ;-)
  • by mattgreen (701203) on Friday March 30, 2007 @02:17PM (#18546645)
    I used to play too much Starsiege: Tribes about five or six years ago. It is a multiplayer first person shooter with enormous maps. When it first came out, everyone walked around, or hitched a ride on a vehicle. The game was fun, but it was a bit slow for my tastes (I grew up on NetQuake). Somebody discovered a physics bug that allowed players to move very fast over terrain by rapidly tapping the jump button as players slid down a hill. This process was scripted, and the overall dynamics of the game (terrible pun) changed dramatically. The game went from being fairly slow to being one of the most intense games I've ever played. Different hills would give different amounts of speed, and the process of 'skiing' itself required that you constantly look for ways to maintain your speed while fighting off other players.

    When the developers saw the potential it gave the game, they left it in. They realized how it made the game unique and exciting, and this bug became the standard feature that sets Tribes far apart from almost all FPS games out there, even to this day. This bug resulted in probably the closest simulation to virtual athleticism that I have ever seen, which was responsible for the fanatical, but small fanbase the Tribes series had.
  • by adavies42 (746183) on Friday March 30, 2007 @02:24PM (#18546771)
    A couple of friends of mine in high school CS wrote a Tetris clone for class, but they had a bug where occasionally, blocks would spontaneously appear or disappear. They couldn't figure out how to fix it, so they claimed (in the docs, not to the teacher) that they had AI adjusting the difficulty to match the players' skills.
  • Date library (Score:5, Interesting)

    by isj (453011) on Friday March 30, 2007 @02:25PM (#18546785) Homepage
    Not me, but one of my colleagues took over maintenance of a system which included a date library. The dates and times were treated as floating-point, leading to much conversion and adjustinging. Eg. 12:30 was 12.30, so when adding 40 minutes getting 12.70, and then adjusting that to 13.10, No input validation was done. My colleague tried cleaning that up, but then got complaints from the users. They had discovered the "features" and were now using eg:
        January -6th
    meaning december 24th the previous year.

    My colleague had to remove the input validation again and keep the features.
  • by mccalli (323026) on Friday March 30, 2007 @02:41PM (#18547053) Homepage
    This was a fun one. I had one of the first MINI Coopers, and ordered it with the CD player ('Wave' option? Seem to remember that name). I forget exactly when I took possession of the car, but I think it was around September or October. Something like that.

    Anyway, at roughly 2:00am every morning the car alarm would go off, much to the 'delight' of myself, my neighbours and everyone in the vicinity. I'd go out, stop the alarm and then try to sleep. After which it would go off again, every hour or so.As if we weren't losing enough sleep with our then new-born daughter.

    The cause was eventually traced, and it's one of the more obscure bugs I've ever come across. Turns out that the car had a low-power rather than completely off mode, and the CD player retained a tiny amount of power going through it. When it was cold, say at 2:00am on an autumn morning for example, the CD player would detect that condensation was forming and would wake up the car's electrics to create some warmth to clear the condensation. This is deliberate, and quite clever I think.

    However, the problem came in that it did this too often and started causing a big drop in battery reserves. The security system interpreted this as an attempt to start the car by hotwiring it, and so the alarm would be set off. I'd come out to switch it off, then go back to bed on the cold autumn night at which point condensation would form again, the CD player would switch itself on again, the security system would sound the alarm again and a bleary-eyed version of me would stagger out to turn the alarm off again. At which point condensation would start to form again and...

    Bah.

    Cheers,
    Ian
    • by Anne Thwacks (531696) on Friday March 30, 2007 @03:02PM (#18547437)
      Sir, you lie.

      The Mini Cooper dates from about 1968, very considerably before the advent of the CD player, and furthermore had even less security than Windows ME. Even if the doors were locked, you could still open them by pushing hard, because the entire door would bend such the lock mechanism no longer held the door shut! It certainly did not have an alarm.

      Not only that, the electrics were so poor, it was not unknown for condensation to completely flatten the battery overnight.

  • by sconeu (64226) on Friday March 30, 2007 @02:42PM (#18547063) Homepage Journal
    I'd argue that C++ Template Metaprogramming as a fully Turing-complete functional programming language was probably an unintended result of the definition of templates.
  • by Col. Klink (retired) (11632) on Friday March 30, 2007 @02:53PM (#18547275)
    My college dorm elevator had bug/feature. If you briefly pulled and then reset the "emergency stop" button as the elevator was stopping at a floor it would skip that floor. I lived on the third floor and we routinely skipped folks on the second floor waiting for the elevator. This was a great time saving feature (except, of course, when the fourth floor residents would skip the third floor).

    The only misfeature of this bug was that the bell would briefly ring alerting those waiting that they had been skipped. One time, some second floor residents heard us skip their floor and we heard them running down after us. We skipped the lobby and went back to the fourth floor. We could have kept it going all night if they tried chasing us, but they didn't. Anyone too lazy to walk to the lobby from the second floor sure isn't going to race up to the fourth floor.

    Eventually, they upgraded the elevator and we had to stop for the second floor whenever they wanted.
  • by Rashkae (59673) on Friday March 30, 2007 @03:00PM (#18547401) Homepage

    If you do a regex search and replace in Open office and replace all contents of cells with themselves (search for .*, replace with &, or something like that) the contents of the cells will be reformated to whatever default you set for the columns. You can use it to change a column of numbers into a text field (to sort alphanumerically) or vice versa,, (if you have a spreadsheet that imported numbers as text and and you want to change them back into numbers)

    This trick is even included in the help documentation.

  • aMSN (Score:4, Funny)

    by Placebo Messiah (895157) on Friday March 30, 2007 @03:10PM (#18547575)
    aMSN has a cool bug that pops a window open on your end as soon as someone clicks on your name on their end

    it's fun to pre-empt conversations with girls:

    me: hey how's it goin?

    her: OMG I was just thinking about you

    me: ya right

    her: I'm serious!

    me: *gush* (L)
  • My favorite bug (Score:5, Interesting)

    by SilentStrike (547628) on Friday March 30, 2007 @03:26PM (#18547807) Homepage
    I was writing code in lisp to remove duplicates from an unordered list.

    How do you do it? Well, here is one reasonable way.

    Sort the items in the list.
    Duplicate items will be adjacent, so scan through the list and add items when they aren't equal to the last item.

    Since it was lisp, I naturally started writing a recursive quicksort.

    My code looked something like.

    quicksort (list)
        if list has size less than 2, return list
        Pick pivot from list
        L = filter items in list < pivot
        G = filter items in list > pivot
        return quicksort(L) + pivot + quicksort(R)

    However, my quicksort had a bug in it.

    Look closely.

    It didn't append copies of pivot to the returned sorted list. Thus, it removed them. Since every item eventually ends up as the pivot, all duplicates are removed. It's the only bug that has ever ended up saving me time.
  • Lesson here is: (Score:5, Insightful)

    by geekoid (135745) <dadinportland&yahoo,com> on Friday March 30, 2007 @03:33PM (#18547925) Homepage Journal
    Don't start modifing code until you understrand how the users use the product.

    It is only refactoring if the users sees no change, with the sole exception of performance gains.
  • Intestinal flora (Score:5, Insightful)

    by tverbeek (457094) on Friday March 30, 2007 @03:38PM (#18547985) Homepage
    The bacteria in my digestive tract are bugs I would definitely miss.
  • Automotive Bug (Score:5, Informative)

    by wramsdel (463149) on Friday March 30, 2007 @04:14PM (#18548529)
    I always enjoyed cars with "child-safe rear windows" which don't roll all the way down. In many cases, this is because the rear wheel well cuts into the door, reducing the space available for the window.
  • by Linker3000 (626634) on Friday March 30, 2007 @04:50PM (#18549031) Journal
    Hows about triple faulting the 80286 processor to drop out of protected mode?

  • by WindowsTroll (243509) on Friday March 30, 2007 @06:02PM (#18549967) Homepage
    Your assumption seems interesting to me. In a production environment end users are using an application that obviously is useful. In your attempt to "clean up unreadable code", it no longer works. What you did instead was make the code perhaps more readable, but you changed the functionality. Perhaps more pejoratively, you broke what was previously working. Instead of looking at your self to see what you broke, your assumption is that it all worked by accident.

    Before committing any changes to a production system, I would expect that a developer would test the functionality before making change and compare the results after changes were made. This would have uncovered that you changed functionality. Another tact would have been to create unit tests before making your changes, and then run those test as you were making changes. You have have discovered that you changed functionality. Instead, you did neither, and you broke a feature.

    I'm a little long in the tooth, working 18 years as a programmer. I've seen this situation many times. Every young new hire thinks that they are smarter than the people hired before them and that all of the existing code is crap. It all needs to be rewritten because the previous coders were bad programmers and if it were redone, it would be cleaner. So they rewrite existing code and they break things. I can only assume that you work for a PHB.

    Any manager worth their salt would initially halt a rewrite of WORKING code. If you want to modify something that is working and has been working and has had the bugs worked out, you will really need to prove that there are benefits to doing so. And as a manager of a development group, anytime someone who is still wet behind the ears wants to rewrite code, I tell them to step back and look at the code again. Is the code really crap or is it that you just don't understand what it is doing? Perhaps having an older coder walk through some of the code, maybe explain why the code was written a certain way, might shed some light on how it is really functioning. The fact that in your case you changed functionality, it shows that you didn't understand what was going on in the first place.

Passwords are implemented as a result of insecurity.

Working...