Slashdot Mirror


Open Source Programmers Stink At Error Handling

Mark Cappel writes: "LinuxWorld columnist Nick Petreley has a few choice words for for the open source community in 'Open source programmers stink at error handling'. Do you think commercial software handles errors better?"

610 comments

  1. In a word? by Anonymous Coward · · Score: 0

    Yes.

    But not for the reasons everyone normally thinks.

  2. fp by titurel · · Score: 0, Troll

    pirst prost

    1. Re:fp by Anonymous Coward · · Score: 0

      You:

      Can't spell.
      Can't type.
      Suck.
      Can't get fp.
      Have a small weenie.

  3. agreed by vcv · · Score: 0, Troll

    agreed, bad error handling.

  4. Linus' changes to recent kernels by xjicex · · Score: 1

    Linus' changes to 2.4.10,2.4.11 were improvments
    to error handling. Open source developers might
    not be to good at this, but at least in the nature
    of open source it is found and corrected.

    1. Re:Linus' changes to recent kernels by PinkFreud · · Score: 1

      Tell that to my SMP box, where 2.4.x still freezes with SMP support. No errors, either.

      See http://marc.theaimsgroup.com/?l=linux-kernel&m=100 360434129916&w=2 for details.

    2. Re:Linus' changes to recent kernels by sydb · · Score: 2

      no errors
      Nothing to handle then stupid.

      --
      Yours Sincerely, Michael.
    3. Re:Linus' changes to recent kernels by PinkFreud · · Score: 1

      Correction: no error messages. As for errors, I'd call locking up the system one hell of an error.

    4. Re:Linus' changes to recent kernels by Anonymous Coward · · Score: 0

      Maybe you could give a few more details about your systems configuration. Surprisingly I had a rock solid server class machine (Asus P2B-DS with 2 PIII 500 processors and 256 MB ECC RAM, 2 9GB SCSI Quantum Atlas 10K drives etc...) lock up on me shortly after installing Redhat 7.1. The machine finally got to a point where posting became difficult and I sent it out for repairs (current hypothesis is one bad processor I hope the motherboard has not gone south). I've been chalking it up to hardware failure (although with those kind of components it should be rare), could this be O/S triggerred? What is your situation?

    5. Re:Linus' changes to recent kernels by nr · · Score: 0

      Blame the computer owner for buying bad quality el-cheapo shit hardware. I have never experienced a system lockup or kernel panic in the 6 years i've run Linux. And that includes _development_ kernels lines like 2.1.x and 2.3.x

  5. Open source BSOD library. by aralin · · Score: 2, Funny

    We really need this open source BSOD library
    that would make our life more convenient and
    our applications more commercial-like.

    --
    If programs would be read like poetry, most programmers would be Vogons.
    1. Re:Open source BSOD library. by xmedar · · Score: 2

      I always prefered the Amigas "Guru Meditation" error messages, I just wish they had combined it with a Zen Koan generator or quote of the day, it would have made figuring out what went wrong even more fun!

      --
      Any sufficiently advanced man is indistinguishable from God
    2. Re:Open source BSOD library. by FreshFromTheCows · · Score: 0

      Well, I believe I heard somthing about microsoft putting some digital rights management in the BSOD code.. Why, with that in place, I don't believe that we'll be seeing it in the OSS comunity any time soon, seeing how MS security is unbreakable and all... ;) Blaa, Flame away, tis only a joke..

    3. Re:Open source BSOD library. by nomadic · · Score: 2


      We really need this open source BSOD library
      that would make our life more convenient and
      our applications more commercial-like.


      So you're attributing a Windows-specific problem to all commercial software everywhere?

    4. Re:Open source BSOD library. by fredrik70 · · Score: 1

      guru Mededitation is definetly the way forward...
      actually almost made it a joy of crashing your amiga...

      --
      if (!signature) { throw std::runtime_error("No sig!"); }
    5. Re:Open source BSOD library. by Ziviyr · · Score: 1

      Be nice if the user could config the color. I'd like to see the occasional orange screen of death...

      --

      Someone set us up the bomb, so shine we are!
    6. Re:Open source BSOD library. by IpalindromeI · · Score: 1

      Actually, you can customize the color.

      --

      --
      Promoting critical thinking since 1994.
    7. Re:Open source BSOD library. by drsquare · · Score: 1

      But he wanted orange, the site you linked to only showed how to do it with the 16 standard colours.

  6. /.ed already by Anonymous Coward · · Score: 0

    Seconds after the story was posted, LinuxWorld is already gone... :-p

    1. Re:/.ed already by Anonymous Coward · · Score: 1, Funny

      Yeah, LinuxWorld might want to work on their error handing... :-p

  7. Open Source software error handling? by Anonymous Coward · · Score: 0

    You mean, that exists?

    There are some good pieces of Open Source software out there, sure, but most of it isn't all that great. Shit shouldn't crash when a directory it's been stat()ing suddenly no longer exists or its config file hasn't been created yet. Lots of Open Source software does that, though.

  8. In the case of some of us... by brunes69 · · Score: 4, Funny

    Who spend days at a time at work (read: Stallman) without showers, removing the last 3 words provides a better description :o)

  9. No, its not limited to OSS by ArcadeNut · · Score: 4, Insightful
    Commercial Developers are just as bad. If you ever see an "Access Violation" or "Unhandled Exception in blah...", chances are, the programmer didn't do proper error handling or checking for error conditions.

    Things like checking pointers to see if they are NULL before using them. Simple basic things that could prevent errors.

    Error handling doesn't just mean catching the error after its already happened. It also means being proactive about it before it happens.

    A lot of programmers do not do that.

    --
    Visit the Arcade Restoration Workshop @ http://www.arcaderestoration.com
    1. Re:No, its not limited to OSS by deranged+unix+nut · · Score: 3, Insightful

      No, but frequently error cases are only added because good testers force the programmer to take care of all of the edge cases.

      I have forced the developers that I work with to add hundreds of error case checks in the last year. :)

    2. Re:No, its not limited to OSS by Anonymous Coward · · Score: 1, Funny

      My favorite example:

      I called BEA support to ask why WebLogic 5.1 would scroll 4 pages of exceptions/stacktraces to the console every time I started it up.

      BEA support monkey: "Oh, that's normal. Just ignore it."

      Enterprise software is such a joke.

    3. Re:No, its not limited to OSS by RetroGeek · · Score: 1

      A lot of programmers do not do that.

      A lot of novice programmers do not do that.

      It takes a few times of having been bitten by lazy coding that a programmer learns that those extra few lines of code actually make life easier. Unfortunately each generation must "burn its fingers on the stove", because that is the human animal.

      OTOH, without this inclanation we would still be living in trees, because our parents were afraid to cross that savana....

      --

      - - - - - - - - - - -
      I am a programmer. I am paid to produce syntax not grammar. Deal with it.
    4. Re:No, its not limited to OSS by xmedar · · Score: 2

      Good for you, and no thats no sarcasm, we need better testing regimes in commercial software development companies, and developers, you should ask for some metrics on code before you join a team, testing is crutial if yo're going to ship a good product, code reviews, test harnesses etc should all be in abundance. Sadly what happens in a lot of cases is Marketing says deliver on day X, where day X is some random day that they thought up rather than a "real deadline" ("real deadline" being a competitor about to trample you etc) then you have to massage the code, work 18 hours a day, not do testing just so everything fits in with when Marketing want to launch their ad campaign (usually about a month after their Kenyan safari). I have personally expereinced this, and its not fun at all. If you want a professional level product you need to plan, design implement and TEST. The most recent high profile case I can think of is Oracles CRM offering which sucks, and doesnt have functionality that corporations were sold on. So now I know many people looking for alternatives to Oracle, not just for CRM but DBMS as well, give a dog a bad name and all that.

      --
      Any sufficiently advanced man is indistinguishable from God
    5. Re:No, its not limited to OSS by humblecoder · · Score: 1
      Commercial Developers are just as bad. If you ever see an "Access Violation" or "Unhandled Exception in blah...", chances are, the programmer didn't do proper error handling or checking for error conditions.

      Shouldn't OS developers aspire to be better than that? Just because some commercial app has cryptic error messages doesn't mean that it's okay.

    6. Re:No, its not limited to OSS by codingOgre · · Score: 1

      I am sure that however bad Oracle's CRM software is it can't hold a candle to how shitty E.phiphany is. The IP code is pure shit and falls over all of the time.

      --
      Space may be the final frontier, but it's made in a Hollywood basement. --Red Hot Chili Peppers, Californication
    7. Re:No, its not limited to OSS by susano_otter · · Score: 2

      Funny E.piphany story:

      My company contracted them to implement a site metrics solution. . . the first inkling I had that something was wrong came as a result of the following:

      SENIOR E.PIPHANY CONSULTANT: Hey, this server you've given us? Does it have any utilities on it to run periodic processes? You know, like every day at the same time, run a process?

      [The consultant goes on to name two or three 3rd-party process-scheduling apps that I've never heard of. This doesn't bother me too much though, because I'm thinking:]

      ME (out loud): Well, there's cron, right?

      CONSULTANT: "cron"? What's "cron"? Does it schedule processes?

      . . .

      Two days later their senior DBA tried to tell me that I couldn't get RAID-5 out of a three-drive array...

      --

      Any sufficiently well-organized community is indistinguishable from Government.

    8. Re:No, its not limited to OSS by jweatherley · · Score: 2, Insightful
      Things like checking pointers to see if they are NULL before using them. Error handling doesn't just mean catching the error after its already happened. It also means being proactive about it before it happens.

      There's two ways of going about this kind of error and which one you choose depends on circumstance:

      1
      if(ptr != NULL)
      {
      //Do Stuff
      }
      else
      {
      // Attempt to recover
      }

      2
      assert(ptr);
      // Do Stuff

      The advantage of one is that the program won't stop but you won't get so many bug reports. What if some code hundreds of lines away expected this to have worked? When the program does eventually fail you may be a long way from the real cause - debugging hell...
      Two will let you know when that pointer is unexpectedly NULL straight away so the bug is more likely to be caught during development - a good thing!
      It can be a good thing to have code that stops as soon as it hits a problem - especially development code. Though stuff like autopilots had better keep going - and have been through a good testing cycle in the first place.

      --

      --
      Reverse outsourcing: it's the future
    9. Re:No, its not limited to OSS by mr3038 · · Score: 2
      [Speaking about the problems with error recovery...] What if some code hundreds of lines away expected this to have worked?

      In that case this part of code is correct and the one that "expects" this part executed successfully is the buggy one. You're missing similar check(s) there!

      The assert()-way is for programmers who don't want to handle exceptions but trust that they don't happen. Assert() clauses are used during developement to catch programming errors but they are usually removed from final release "because it runs faster that way". Even so, I think assert() is better than nothing. If you don't want to do real exception handling you should at least use assert()s.

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
    10. Re:No, its not limited to OSS by follower-fillet · · Score: 1

      The two approaches aren't mutually exclusive. Combine the two approaches:

      if (ptr != NULL) {
      // Do Stuff
      } else {
      assert(ptr); // Or even assert(0); if you want...
      // Attempt to recover
      }

      At least that's the way I do it. Assert was never intended to be used in production code, that's why it checks for the NDEBUG macro being defined.

      Run your unit tests twice, once with NDEBUG defined and then without it. Okay, so it's possible that a failure might still occur the second time but if you code them without side-effects (or even use the 'assert(0);' idiom*) it's tending towards the unlikely side.

      Phil.

      *The disadvantage with using 'assert(0);' is that you don't get as much information from the error message, but the advantages are:
      + Definitely no side effects.
      + No variation between debug and production code. i.e. if you're testing a bunch of parameters at the head of a function you can use:

      if ((piA == NULL) || (ppiB == NULL) ||
      (*ppiB == NULL)) {
      assert(0);
      // Production recovery here...
      }

      This avoids the alternative where you would precede the 'if' with a bunch of asserts, which aren't actually guaranteed to check the same situations as the 'if'. E.g. you use assert(ppiC != NULL) but never check for that in your 'if'.

    11. Re:No, its not limited to OSS by Anonymous Coward · · Score: 0

      Call me stupid, but isn't it crazy to say that commercial developers are better at handling errors (or vice versa) because the majority of open source developers are commercial developers by day. Open source is great, but for most it doesn't pay the bills

    12. Re:No, its not limited to OSS by Grab · · Score: 2

      Amen. Matlab is my current Private Enemy #1. In the 6 months from getting this PC loaded with Win98 (yes, I know, but this is work) to getting Matlab installed, it shut down properly 9 times out of 10. Since using Matlab, I have NEVER had the PC shut down correctly. Never. Every time, I have to do the hard poweroff and sit through ScanDisk the next morning. And this isn't just me - every engineer in my office experiences exactly the same thing. A 100% record of failure is not what I'd call acceptable for _any_ software, never mind commercial stuff that's selling for umptitum thousand dollars a seat!

      Grab.

    13. Re:No, its not limited to OSS by jcast · · Score: 1
      + No variation between debug and production code. i.e. if you're testing a bunch of parameters at the head of a function you can use:

      if ((piA == NULL) || (ppiB == NULL) ||
      (*ppiB == NULL)) {
      assert(0);
      // Production recovery here...
      }

      How about:
      #define TEST(case, correction) if (!case){assert (case); correction;}
      ?

      You call it like this:
      TEST(((piA != NULL) && (ppiB != NULL) &&
      (*ppiB != NULL)), //Production error recovery here
      )

      Yeah, C's macros suck. Better would be to come up with some kind of fancy macro to get rid of assert () entirely. But, you get the idea.
      --
      There are reasons why democracy does not work nearly as well as capitalism.
      -- David D. Friedman
  10. What errors? by geekfiend · · Score: 1

    Error handling is much less important when the frequency of errors is so low with in our community. Error handling is even less importnat when the results of errors don't cause things like BSODs, GPFs or icons with frowning faces.M$ and others need to be more concerned with error handling because it's a much more common occurance in the closed source world.

    1. Re:What errors? by Anonymous Coward · · Score: 0

      What errors?

      User errors maybe?

    2. Re:What errors? by Anonymous Coward · · Score: 0

      What's your point?

      Obviously an OS run by computing enthusiasts and networking professionals where every thing has to be recompiled regularly (because there's no ABI) isn't going to be as unstable as one that works toward, and often attains, binary compatability with software written as long as 17 years ago.

      Get real. Stop drinking the Kool-Aide.

    3. Re:What errors? by Anonymous Coward · · Score: 0

      So the marketing driven insistence of keeping backwards compatibility makes the resulting code much more complicated and error prone.

      Which side are you arguing here?

    4. Re:What errors? by Cato+the+Elder · · Score: 3, Insightful

      Bullshit.

      Sure, an application error in a Unix derived system is much less likely to bring down the whole system. But that's no excuse for not dealing with error conditions correctly.

      Also "errors" don't just occur from bad code. Running Linux gives you no protection against drive failures, network flakiness, or plain old user error.

      Sure, if the error messages is misleading you can look in the source to find out what actually caused the error. Heck, even if it SEGVs you can compile it with debugging symbols and let GDB tell you what line it's failing at.

      However, the open source community will NEVER attract mainstream users with that kind of attitude. Furthermore, even hardcore geeks should have better things to do fix up crud in supposedly release quality code. Hey, it's one thing if I'm working on something clearly under development, but it's nice to be able to get stable stuff to.

      That said, I don't find open source to be any worse than the commercial stuff I've worked with. With, say, Microsoft stuff, it is just much harder to distinguish bad error handling code from bad code even when no error conditions are encountered.

    5. Re:What errors? by Malc · · Score: 1

      So why do I have lots of files named "core" littered throughout my system?

    6. Re:What errors? by t · · Score: 1

      Because you don't know about the bash "ulimit -c 0" function.

    7. Re:What errors? by klui · · Score: 1

      Your comment is unfounded. Would you prefer to have a program exit or dumping core without any message or something that says "cannot open /some/bogus/path. It is not a readable file"?

      It is a lot easier to not check for errno but its existence is there for a reason--to allow programmers to write friendlier code. I have been guilty of not checking for return status/errno in the past and have been burned by this omission during deep production support.

      Of course, errors don't apply to you since you write perfect code.

    8. Re:What errors? by Anonymous Coward · · Score: 0

      I think you mean he doesn't write any code. I'm an undergrad MCS student, and even I know the importance of error checking. Of course my prof is D.J. Bernstein where 3/4 of our midterm is error handling :/
      Hes just another lamo posting out of context because he doesn't have anything meaningful to add to the topic on hand... Imagine that on slashdot....

    9. Re:What errors? by Anonymous Coward · · Score: 0

      Bravo. The key problem with moving Linux to the mainstream isn't really the monopolistic practices of Microsoft, it's the arrogance and attitude of SOME Open Source voices.

      Looking at many of the arguments here we can see that a good number have been 1) Well, there are lots of errors in MS stuff so we're OK and 2) we can always just recode our application and 3) At least we aren't Microsoft.

      I'm relatively technical. I can write code, albeit not the best code, install hardware, and even get some things right. But I don't want to use an application I have to debug. It's really that simple. I want people who are better at it than me writing good code for me to use. Sorry if that violates some juvenile 'Hack the World' ethic, but I have stuff to see and people to do.

      Just 2 cents against a flood of other people's money, I guess.

    10. Re:What errors? by kraig · · Score: 1

      that's ok... I was told by the master's student "teaching" my course on *program design* during the final exam for that course to not bother checking any user input for errors, because I should "assume that the user has read and understood the manuals". The same went for checking return codes of system calls, etc. With that sort of attitude, who needs Microsoft?

    11. Re:What errors? by klui · · Score: 1

      So the computer science student's foundation doesn't have the concept of error checking in it, and the lack of good error checking will perpetuate as this person writes code in the future.

    12. Re:What errors? by kraig · · Score: 1

      Exactly my point.
      Granted, that may have been corrected in future courses; personally, I think that error checking, *particularly* of user input, should be fundamental to teaching programming concepts. It should not be an afterthought, and as such, it should not be something you "learn later".

  11. Errors? by zaius · · Score: 2

    What are these "errors" you speak of? Open source has no errors...

    1. Re:Errors? by Tachys · · Score: 2

      What are these "errors" you speak of? Open source has no errors...

      Think that is what he mean

      Program has shut down, "error"? What error? Open source has no errors.

    2. Re:Errors? by Xerithane · · Score: 2

      There are no errors, only segfaults.

      --
      Dacels Jewelers can't be trusted.
  12. New /. speed record? by MrResistor · · Score: 2
    The page cannot be displayed

    That's the error I'm getting. Could it possibly be slashdotted in only 3 minutes?

    Too bad, I was hoping I could say something meaningful, or maybe even relevant...

    --
    Under capitalism man exploits man. Under communism it's the other way around.
    1. Re:New /. speed record? by Tyndareos · · Score: 1

      ok, to prevent others from doing so I will make the obligatory wisecrack mentioning "error" and "handling well" ...

    2. Re:New /. speed record? by Anonymous Coward · · Score: 0

      yet more proof linux suxors

    3. Re:New /. speed record? by Anonymous Coward · · Score: 0

      Currently -

      Proxy Error
      The proxy server received an invalid response from an upstream server.
      The proxy server could not handle the request GET /site-stories/2001/1025.errorhandling.html.

      Reason: Could not connect to remote machine: Connection refused

      Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  13. ironic? by 4n0nym0u53+C0w4rd · · Score: 0, Redundant

    When I tried to access the story I got an error message:

    Proxy Error
    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET /site-stories/2001/1025.errorhandling.html.

    Reason: Could not connect to remote machine: Connection refused

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  14. Of Course by moosesocks · · Score: 1

    Its plain and simple. Look at how professionally IE handles bugs. It redirects the user to a page which leads them into believing the browser isnt to blame.

    Mozilla on the other hand takes all the flak for itself and blames itself for other's problems.

    Duh!

    --
    -- If you try to fail and succeed, which have you done? - Uli's moose
    1. Re:Of Course by TheRain · · Score: 2, Funny

      i think you are projecting some of your real life expiriences on web browsers buddy ;)

      --
      Please help! I'm stuck inside my virtual reality headset!
    2. Re:Of Course by Malc · · Score: 1

      IE 6 brings up an error reporting dialog. Not much different from the Talkback thing with Mozilla. On top of that, IE 6 restarts itself.

    3. Re:Of Course by Amazing+Quantum+Man · · Score: 2, Funny
      Well, then obviously, what OSS programmers need to do is have a dialog that pops up:


      $APPLICATION has found something wrong. It is obviously not $APPLICATION's fault, it is most likely something else on your computer, perhaps $RANDOM_CLOSED_SOURCE_APPLICATION.

      We highly recommend that you reinstall your entire system, but do not install $RANDOM_CLOSED_SOURCE_APPLICATION this time.

      Thank you
      --
      Fascism starts when the efficiency of the government becomes more important than the rights of the people.
    4. Re:Of Course by Anonymous Coward · · Score: 0

      Well I know that by default IE6 doesn't restart itself (what distro of XP are you running?). And the error reporting dialog is for every bit of software running under windows (Opera just crashed before and MS wanted the error report).

    5. Re:Of Course by Malc · · Score: 2

      I'm not running XP, and I highly doubt I will in the near future. Win2K serves my needs perfectly well thank you ;) The error dialog doesn't come up for every app: the IE6 one is different to the one in Office XP, and nothing comes up after the frequent crashes of my own programmes that I'm testing. As for IE6 auto-restarting, I don't recall changing anything to make it do that. Office XP apps also restart automatically after one of these crashes.

    6. Re:Of Course by Anonymous Coward · · Score: 0

      Get a grip moderators.

      Just because a comment knocks MS|non-OSS software|IE (delete as applicable), etc. doesn't necessarily make it "3, Funny".

    7. Re:Of Course by mr3038 · · Score: 1
      Get a grip moderators. Just because a comment knocks MS|non-OSS software|IE (delete as applicable), etc. doesn't necessarily make it "3, Funny".

      Uh.. I didn't see any mention about any of those pieces of software you mention in the post that was moderated as "Funny". If $RANDOM_CLOSED_SOURCE_APPLICATION brings some MS apps into your mind it's your problem only. Considering the stunt that MS pulled with MSN yesterday it would be fair to use their browser here though. Too bad it cannot be removed from their system...

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
    8. Re:Of Course by Anonymous Coward · · Score: 0

      Well, another "professional" feature is to tell the user that the site does not exists when it's actually just down (maybe for a short moment and a valuable reason!) - IE simply tells you We can't find "some.site.org" and redirects you to MSN search. But it's just plain wrong - DNS is telling you ok, so it exists!..

    9. Re:Of Course by Anonymous Coward · · Score: 0

      By default, IE6 (whether downloaded or part of XP) has a little check box in the error dialog that asks if you want IE to restart. By default, that box is checked, meaning that IE will restart once you dismiss the error message.

  15. It's not an error... by krmt · · Score: 2

    it's a feature.

    --

    "I may not have morals, but I have standards."

  16. That all depends on... your selection of course! by noahbagels · · Score: 3, Interesting

    Why does it seem like there are as many people in the "community" criticizing open source as there are supporting it?

    Two Words: Apache and Tomcat

    I'm a professional who works with the closed source equivalents all the time: Netscape iPlanet server, IIS and WebLogic.

    Now: before you flame - I like working with WebLogic, but it is no better than Tomcat in my opinion (as far as error reporting goes). And IIS is a piece of crap! Not to mention Netscape's overly complecated UI that blasts every change you've ever made and is completely out of sync with the flat file configs.

    Need I mention that Tomcat error logging is set-up in an XML file that is easy to read, modify, and translate into a simple report for management (IT that is).


    When was the last time Windows gave you a nice error.log when it blue-screened, or how about IIS on a buffer overflow?

    I'm sick of bashing on the free stuff out there. Sure, just because I can release one of my college projects into the open source may mean that statistically there are more projects without good error reporting, the real projects are pretty darn good.

  17. Commercial programmers are worse! by shoppa · · Score: 2, Insightful
    Error handling in a C/Unix environment is, by its nature, very difficult. But at least some open source tools have become very refined over the years and are quite good at it.


    My textbook example:

    • The pwd command.

      It takes no argument, and only produces one line of output. Despite this apparent simplicity, I've been able to get each and every pwd that ships with a commercial Unix to dump core (almost always by executing in an exceedingly deep directory.)


    The GNU shellutils version of pwd, on the other hand, has never dumped core on me.


    I will admit, the fact that it took two decades for a non-crashable version of pwd to become available doesn't bode well for the many other vastly more complicated programs out there in any environment. But it does speak very highly of the GNU utilities in general, and I haven't even begun to praise the thousands of folks who have worked on making these tools quite portable!

    1. Re:Commercial programmers are worse! by Anonymous Coward · · Score: 0

      It's in each and every commercial UNIX because the pwd command was written at AT&T eons ago, probably as part of the SRV2 or SRV3 release. And apparently it doesn't affect too many people.

    2. Re:Commercial programmers are worse! by Anonymous Coward · · Score: 0

      On the other hand, error messages , at least, are much easier in UNIX/C because of functions like strerror() and perror().

      The Win32 equivalent of strerror() is a long call to FormatMessage() with all sorts of funky flags and a pre-allocated string buffer.

    3. Re:Commercial programmers are worse! by Anonymous Coward · · Score: 0

      The GNU utilities aren't that robust either, and I've seen bash dump core on long input strings. Once I accidently left a book leaning on the keyboard and when I came back the shell had crashed.

  18. Blame this on Open Source Programmers only? by ackthpt · · Score: 3, Interesting

    I've been coding for over 20 years and I've seen some beauties, and I'm sure others have as well. Like the guy who put about 500 lines of Java in one Try - Catch. I'd suggest they screen their contributors better. Use a carrot and very gentle stick approach and be certain to encourage coders to think "what could happen here and how should I handle it?" whenever writing.

    --

    A feeling of having made the same mistake before: Deja Foobar
    1. Re:Blame this on Open Source Programmers only? by jawtheshark · · Score: 1
      My personal favourite is:
      try {
      // Many lines of code
      }
      catch ( Exception e ) {
      System.out.println( "Something went wrong!" );
      }
      Yes, I saw such code...often. :-( Each time I see it, my heart nearly stands still. Worse are the methods that do "throws Exception". How am I supposed to do detailed error handling when having to handle all errors at once? Checking types works/casting works but that's about it and looks mighty ugly!

      But then my co-workers wonder why I do paranoid error checking.... Sorry for letting of my frustration :-(

      --
      Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    2. Re:Blame this on Open Source Programmers only? by Prior+Restraint · · Score: 1

      I'll go you one better. My current project is littered with:

      try {
      // Bunch of stuff
      } catch (Exception e) {
      throw new OurCustomException(e.getMessage());
      }

      I still haven't figured out what they were thinking.

    3. Re:Blame this on Open Source Programmers only? by jawtheshark · · Score: 1

      My sympathy...
      I know that kind of code... I know some parts in my current project littered with it too, luckily I'm *not* responsible for maintaining it. I'm still not quite sure what use it has, but I'm thinking someone wanted to try out creating Exceptions of their own just for the sake of it :-)

      --
      Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
    4. Re:Blame this on Open Source Programmers only? by andr0meda · · Score: 1

      I'm not going to get into a Java vs C++ war, but java is a neathly designed modern language with a lot of exception handling built in, so no excuses, while c++ is 20 years old and has a lot of loose ends everywhere (and lots more excuses)

      I think most openSourcerers are using C++, not Java. Ofcourse you can still write propper decent code with most of the error handling in that language, but it's never gonna be as complete as what the Java framework can offer you to support.

      Besides error handling there is also the way in which you test your code. I don't know if you guy's write tests, but since I started working for this new company we decided that we would follow eXtreme Programming to a certain extend, and allways write tests for each class. I must say that the quality of error handling automatically steps-up along the way, as you're inmediately confronted with most of the bugs and errors that can come about. It also offers a good way to prevent the code from being modified in ways that brake the tests as other people add their stuff. We're still in the early stages of our project so I can't really give a general opinion about it, but I'd allready recommend it to everyone.

      --
      With great power comes great electricity bills.
  19. Testing by Taral · · Score: 3, Insightful

    The real problem, IMHO, is that nobody likes to do the intensive testing that is necessary to get a program to be truly robust. We do it here at IBM, and I promise you -- it's not something I would do if I weren't being paid to do it.

    --
    Taral

    WARN_(accel)("msg null; should hang here to be win compatible\n");
    -- WINE source code

    1. Re:Testing by Vanders · · Score: 1

      In general I agree with you. Most Open Source code never gets past the Unit testing stage, and that is only because you tend to test your functions are you write them. In the Open Source model, testing after that is upto the users.

      Now there is nothing wrong with that, as long as the users are actually testing with some sort of structure. Most of your users may only touch upon 10 or 20% of the functionality in your code, and the rare few that might venture into the depths tend not to be able to remember what they did & cannot provide steps to reproduce. Its not much use when you're trying to hunt bugs!

      It would be nice to see Open Source coders start to provide some form of structured Test Plan along with their product, and ask the users who are downloading the software if they wouldn't mind running through some, if not all, of the Test Cases.

      Could it work with Open Source? I don't know, I'm not aware of any previous examples where this sort of Open Source structured testing has taken place :)

    2. Re:Testing by allism · · Score: 1

      I have to agree--and my personal feeling on it is, if there's not good error handling, it's usually because the tester didn't do a good job of finding errors (whether that tester is the programmer herself or someone else hired to test the software). Natch, if there's no money to hire someone to make sure that the software not only does what it's supposed to do, but also doesn't do what it's NOT supposed to do, there's not going to be much quality control.

      There's also not going to be terribly good quality control if the programmer who WROTE the software has to be the same person who TESTS the software. It's just too hard to catch your own mistakes.

    3. Re:Testing by Zurk · · Score: 1

      realistically if youre worth anything as a developer, building a test application that excercises every single bit of your application logic does the trick. sure its painful but i'll take a comprehensive test harness that i can run on my own without a 25 man testing team over a bucnh of human testers any day. code is never meant to be tested by humans. its a mind numbing process which a machine should (and can) handle. same goes for GUI apps. dumping X events to test every menu is something a fairly good developer can write in an evening.

    4. Re:Testing by DrSpin · · Score: 1

      Perhaps you should pay a visit to www.FreeBSD.org or www.NetBSD.org - open source does not mean Linux.

    5. Re:Testing by Diomedes01 · · Score: 1

      Mmm... Fagan reviews are so much fun. On the plus side, they do catch quite a few errors. That's what I have to keep telling myself in order to endure the pain.

      --
      "To hope's end I rode and to heart's breaking: Now for wrath, now for ruin and a red nightfall!"
    6. Re:Testing by Anonymous Coward · · Score: 0

      Why is that ? The best tester is the programmer itself. After all you wrote the code, you know all the branches of execution and exceptions. Look at your code and try to figure out where it will go wrong. Then test it...

    7. Re:Testing by sqlrob · · Score: 2

      Not true. It is exceedingly difficult to see some of your own code flaws.

    8. Re:Testing by Anonymous Coward · · Score: 0

      Yes, because we all know that FreeBSD and NetBSD run completely different application software from Linux, right?

      Dumbass. Stop trolling.

    9. Re:Testing by Bert64 · · Score: 1

      Very true, afterall.. if you could see the flaws, you`d not have written the code in the flawed way to start with. I have often spent hours looking for a bug in my own code, often to have someone else spot it in seconds..

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    10. Re:Testing by Anonymous Coward · · Score: 0

      realistically if youre worth anything as a developer, building a test application that excercises every single bit of your application logic does the trick

      While coverage tools (e.g. gcov or tcov) and exercisers are useful, hitting every line of code is not feasible in many applications or systems software, especially the ones that have the most difficult (software) bugs of all (I think timing bugs are hardest to catch, synchronization/mutual exclusion errors are second toughest). The combinatorial explosion of the range of inputs you have to try and number of test cases is not in your favor.

      One interesting example of this is that the error handling code itself tends to be buggy, since the errors which lead to its invocation can be rare and hard to reproduce, causing a lightly tested or untested handler to be invoked. I don't know about open source (I had too much work for pay to do too much open source stuff) but in industry this was a perennial problem.
    11. Re:Testing by alcmena · · Score: 1

      True, the coder can test for many of the basic errors. However, the original programmer is likely to completely suck at testing for logic mistakes and incorect assumptions. Why? Because that programmer is very likely to make the same false assumptions in the testing round that he/she did in the coding phase.

      The motto at a company I used to work for was simply that the coder should code and the tester should test, and never shall the two meet. It worked quite well because the tester was forced to meet with the customers and test in real-life situations. While the coder often tried to live in his/her own virtual world and would never have caught as many problems.

    12. Re:Testing by Phiu-x · · Score: 0

      "It's just too hard to catch your own mistakes"
      Its just what the said...

      Anyways,I agree with both of you!

      --
      This is a stolen sig.
    13. Re:Testing by malfunct · · Score: 1
      And if you test like this you waste tons of CPU cycles and do not catch the most difficult bugs. Automated testing like that is extremely useful, but its not the answer in the end. Only intelligent thought about things that have gone wrong in the past and might go wrong with your code can bring about a useful test plan.

      I'm a functionality tester as a profession and I can say that without a doubt, calling every function once does not test that the function "works". Its a well known fact that exhaustive testing is impossible so a tester needs to think about what things normally go wrong and test for that.

      These include things such as "What if I choose the wrong data type to send to this procedure." clear to abstract wierd things such as "What if I try to open a file after having saved a file" where you find that the programmer forgot to reinit his buffer and you get garbage appended to the end of whatever you opened. Don't even ask me about multi-threaded issues.

      So anyways I'm not saying that you don't have good ideas, just trying to break the illusion that testing every function is exhaustive testing.

      --

      "You can now flame me, I am full of love,"

  20. The story by Hal-9001 · · Score: 1

    Since LinuxWorld seems to be /.ed already, here's the story:

    Open source programmers stink at error handling
    Commercial programmers stink at it too, but that's not the point. We should be better.
    Summary
    Why are we subjected to so many errors? Shouldn't open source be better at this than commercial software? Where are the obsessive-compulsive programmers? Plus, more reader PHP tips. (1,400 words) By Nicholas Petreley

    (LinuxWorld) -- Thanks to my very talented readers I've been able to start almost every recent column with a reader's PHP tip. I'm tempted to make it a regular feature, but with my luck the tips would stop rolling in the moment I made it official. So I want you to be aware that this week's tip is not part of any regular practice. It is purely coincidental that PHP tips appear in column after column. Now that I've jinx-proofed the column, I'll share the tip.

    Reader Michael Anderson wrote in with an alternative to using arrays to pass database information to PHP functions. As you may recall from the column Even more stupid PHP tricks, you can retrieve the results of a query into an array and pass that array to a function this way:

    Michael pointed out that you can also retrieve the data as an object and reference the fields as the object's properties. Here's the above example rewritten to use objects:

    name;
    echo $CUST->address;
    }
    ?>

    I can't help but agree with Michael that this is a preferable way to handle the data, but only because it feels more natural to me to point to an object property than to reference an element of an array using the string name or address. It's purely a personal preference, probably stemming from habits I learned using C++.

    OCD programmers unite

    Nothing could be a better segue into the topic I had planned for this week. I'm thinking about starting a group called OLUG, the Obsessive Linux User Group. Although I know enough about psychology to know I don't meet the qualifications of a person with full-fledged OCD (Obsessive-Compulsive Disorder), I confess that I went back and rewrote my PHP code to use objects instead of arrays even there was no technical justification for doing so.

    Certain things bring out the OCD in me. Warning messages, for example. It doesn't matter if my programs seem to work perfectly. If a compiler issues warnings when I compile my code, I feel compelled to fix the code to get rid of the warnings even if I know the code works fine. Likewise, if my program generates warnings or error messages at run time, I feel driven to look for the reasons and get rid of them.

    Now I don't want you to get the wrong impression. My PHP and C++ code stand as testimony to the fact that my programming practices don't even come within light years of perfection. But just because I do not live up to the standards I am about to demand isn't going to stop me from demanding them. It's my right as a columnist. Those who can, do. Those who can't, write columns.

    I'll be blunt. Open source programmers need to stop being so darned lazy about error handling. That obviously doesn't include all open source programmers. You know who you are.

    If you want a demonstration of what I mean, start your favorite GUI-based open source applications from the command line of an X terminal instead of a menu or icon. In most cases this will cause the errors and warnings that the application generates to appear in the terminal window where you started it. (There are exceptions, depending on the application or the script that launches the application.)

    Many of the applications I use on a daily basis generate anywhere from a few warnings or error messages to a few hundred. And I'm not just talking about the debug messages that programmers use to track what a program is doing. I mean warning messages about missing files, missing objects, null pointers, and worse.

    These messages raise several questions. Doesn't anyone who works on these programs check for such things? Why do they go unfixed for so long? Are these problems something that should be of concern to users? Worse, what if these messages appear because of a problem with my installation or configuration, and not because the program hasn't been fully debugged? But even if it is my installation that is broken, shouldn't the application report the errors? Why do I have to start the application from a terminal window to see the messages?

    Getting a handle on errors

    At first I wondered if this was a problem that you would be more likely to find when developers use one graphical toolkit rather than another. But I see both good and bad error handling no matter which tools people use. For example, the GNOME/Gtk word processor AbiWord has been flawless lately. Not a single warning or error message appears in the console. It's possible that AbiWord simply isn't directing output to the console, but I'm guessing that it's simply a well-tested and well-behaved application.

    On the other hand, GNOME itself has been a nightmare for me lately. At one point I got so frustrated that I deleted all the configuration files for all of GNOME and GTK applications in my home directory in disgust, determined never to use them again. When I regained my composure and restarted GNOME with the intent of finding the cause of the problems, the problems had already disappeared. Obviously one or more of my configuration files had been at fault. Which one, I may never know, because GNOME or some portion of it lacked the proper error handling that should have told me.

    In this case I was lucky that the problems were so bad I lost my temper and deleted the configuration files. In most cases, the applications appear to function normally. Aside from being ignorant of any messages unless you start the application from a terminal, there's no way of knowing why the warnings exist, or if they are cause for concern. The warnings could be harmless, or they could mean the application will eventually crash, corrupt data, or worse.

    Examples

    Just so you know I'm not making this up, here are some samples of the console messages that appeared after just a couple of minutes of toying with various programs. By the way, did you know you can actually configure the Linux kernel from the KDE control panel? Bravo to whoever added this feature. Nevertheless, when I activate that portion of the control panel, I get the message:

    QToolBar::QToolBar main window cannot be 0.

    Is there supposed to be a toolbar that isn't displayed as a result? I may never know.

    The e-mail client sylpheed generates this informative message after about a minute of use:

    Sylpheed-CRITICAL **: file main.c: line 346 (get_queued_message_num): assertion `queue != NULL' failed.

    The Ximian Evolution program generates tons of warnings, but most are repetitions. They begin with the following:

    evolution-shell-WARNING **: Cannot activate Evolution component -- OAFIID:GNOME_Evolution_Calendar_ShellComponent
    evolution-shell-WARNING **: e_folder_type_registry_get_icon_for_type() -- Unknown type `calendar'
    evolution-shell-WARNING **: e_folder_type_registry_get_icon_for_type() -- Unknown type `tasks'

    The KDE Aethera client generates even more warning messages than Evolution, but many of them are simply debug messages about what the program is doing. By the way, I finally figured out why I couldn't login to my IMAP server with Aethera. The Aethera client couldn't deal with the asterisks in my password. I could log in after I changed my password, but I still can't see my mail. The program simply leaves the folder empty and says there's nothing to sync. Here are just a few of the countless warnings I get from Aethera, including the sync message.

    Warning: ClientVFS::_fact_ref could not create object vfolderattribute:/Magellan/Mail/default.fattr
    Reason(s): -- object does not exist on server
    Warning: VFolder *_new() was called on an already registered path
    clientvfs: warning: could not create folder [spath:imap_00141, type:imap]
    RemoteMailFolder::sync() : Nothing to sync!

    The spreadsheet Kspread reports these errors all the time, even though what I'm doing has nothing to do with dates or times:

    QTime::setHMS Invalid time -1:-1:-1.000
    QDate::setYMD: Invalid date -001/-1/-1

    The e-mail client Balsa popped up these messages just moments after using it:

    changing server settings for '' ((nil))
    ** WARNING **: Cannot find expected file "gnome-multipart-mixed.png" (spliced with "pixmaps") with no extra prefixes

    The Gnumeric spreadsheet only reported that it couldn't find the help file, as shown below:

    Bonobo-WARNING **: Could not open help topics file NULL for app gnumeric

    Many of these problems could easily have been handled more intelligently. For example, Gnumeric could have asked for the correct path to the help file, perhaps adding an option so a user can decide not to install the help files and disable the message. Unless GTK and Bonobo are a lot more complicated than they should be, it should be easy to create a generic component for handling things like this and then use the component to handle all optional help files as a rule.

    The only conclusion I can draw is that, like most commercial software developers, many open source programmers are just plain lazy about proper error handling. But we're supposed to be better than that, and it's time we started to live up to the reputation. I realize that most of these programs are works in progress. But good error handling is not something that should be left for last. It should be part of the development process. Although I may not practice it myself, I'm not the least bit ashamed to preach it.

    --
    "It take 9 months to bear a child, no matter how many women you assign to the job."
  21. I think I've got it down by SanLouBlues · · Score: 5, Funny

    As a professional programmer I adhere to a strict stylesheet which I think the Open Source community may appreciate a copy of:

    main( arguments ){
    try{
    --code goes here--
    }catch( exception ){
    printout "I'm sorry to do that you need our $50k/year support plan. \n Thank you!"
    }}

    No need to thank me.

    1. Re:I think I've got it down by tcc · · Score: 1, Redundant

      1.1

      main( arguments ){
      try{
      --code goes here--
      }catch( exception ){
      printout "I'm sorry $username, I'm affraid I can't do that"
      }}

      --
      --- Metamoderating abusive downgraders since my 300th post.
    2. Re:I think I've got it down by Anonymous Coward · · Score: 0

      1.2

      main( arguments ){
      try{
      --code goes here--
      }catch( exception ){
      printout "I'm sorry $username, I'm afraid I can't do that"
      }}

    3. Re:I think I've got it down by Anonymous Coward · · Score: 0
      hmp!

      int main (args)
      {
      try
      {
      --code goes here--
      }
      catch (...)
      {
      printout "damn, let me try that again";
      return main (args);
      }
      }

    4. Re:I think I've got it down by selectspec · · Score: 2

      // low budget version....

      try {
      --code--
      } catch(exception e) {
      // TODO....
      throw e;
      }

      --

      Someone you trust is one of us.

    5. Re:I think I've got it down by Anonymous Coward · · Score: 0

      // lower budget version....

      pubic void myMethod() throws Throwable
      {...}

    6. Re:I think I've got it down by elflord · · Score: 2

      That's not legal C++ (though g++ will compile it unless you use -pedantic)

    7. Re:I think I've got it down by B00mZilla · · Score: 1

      Mod this up! That's the funniest thing I've read on here in a long time. Good one.

    8. Re:I think I've got it down by Anonymous Coward · · Score: 0

      Funny. But buggy:

      This will work only for console programs, as AWT executes in a separate thread and you will never catch an exception.

      Sorry 'bout that.

    9. Re:I think I've got it down by nick-less · · Score: 1


      As a professional programmer I adhere to a strict stylesheet which I think the Open Source community may appreciate a copy of:


      Yep, I cant see what's the problem with:

      segmentation fault, core dumped..

    10. Re:I think I've got it down by jshep · · Score: 1

      The sad truth is I worked on a couple of products for a gov contractor a couple of years ago that featured main() methods similar to that... and that was the only error handling in the entire program!! One was written in C++ and one was written in Ada; both support exception handling mechanisms. They were both horrid to debug as you can well imagine.

      --


      "Computer Science is no more about computers than astronomy is about telescopes." - E.W. Dijkstra
  22. I agree wholeheartedly by Anonymous Coward · · Score: 0

    There is no substitute for a good ol' BSOD.

  23. Error handling... by mcpkaaos · · Score: 5, Interesting

    ...is only as solid as the engineer behind it (and the design behind him/her). A poor design often results in a flaky system, difficult to implement and nearly impossible to predict. That, in turn, can result in very thin error handling. Whether or not a product is commercial has nothing to do with it. The only argument for that could possibly be that in many cases, more careful attention (in the form of testing and code reviews) is taken when a product is a revenue generator (or anything that will affect the perception of the quality of a company's engineering ability).

    Ultimately, if the engineer (or team of engineers) is inexperienced, error-handling will be weak, error-recovery nearly non-existant. However, a more senior engineer will generally start from error handling on up, making sure the code is robust before diving too deeply into business logic. The time taken for unit testing plays an especially large role here. The more time spent trying to break the code (negative test cases) the more likely you will have a system that has been revised throughout development to have rock-solid error handling/reporting/recovery.

    [McP]KAAOS

    --
    It goes from God, to Jerry, to me.
    1. Re:Error handling... by The+Panther! · · Score: 1

      Have to agree that seasoned engineers who understand exception handling begin with error recovery and reporting, then build apps on top of that foundation. I haven't seen a lot of good error handling code that could be improved upon by greater experience in engineering. The approaches are fundamentally different, where simple error handling requires diligence and exception handling requires only forethought.

      I ran into a serious problem with ghostscript a while back where we couldn't determine if it was correctly interpreting the command line and job options we were sending it. The way they wrote it, it turns out you can pipe /dev/rand to its command line and it will happily do whatever it feels like and you'd never know. That's poor programming, not just error recovery. But that's the only serious OSS example I can name.

      As a 'professional', my bent is to make my program so damn picky that any wrong parameter or character that is out of place will cause the utility to bomb and tell you why. Garbage In/Garbage Out. If you feel crap into a system, it's better that you don't get crap back out, but rather get nothing until you fix your data. Not too many people believe in that so strongly, so you have a lot of utilities where you don't know what it'll do when the data is bad.

      --
      Any connection between your reality and mine is purely coincidental.
    2. Re:Error handling... by vlad_rodionov · · Score: 1

      I think you got it wrong. This is not a critique of qualitu of open source programmers but of open source development model as a whole. No matter how good the individual programmers may be. The flow of the development process doesnt allow for good testing.

      --

      USA-UK-Israel: The real Axis of Evil
  24. He has a point... by weav · · Score: 1

    Petreley writes:
    The only conclusion I can draw is that, like most commercial software developers, many open source
    programmers are just plain lazy about proper error handling. But we're supposed to be better than that...


    Doing good error / exception handling is tedious, requires hard thought, and is nowhere near as fun as writing the mainline code. It requires a lot of discipline to first sit down and think through an exception-handling policy, to stick with it while coding, and then to audit the code and ensure that everything sticks to it.

    Lots of commercial projects, in the rush to get out the door, skip all the above, or some. Open source projects may or may not have the philosophy worked out, let alone the discipline.

    I guess we need a small army of exception-handling drill sergeants looking over code and yelling "YOU CALL THAT ERROR HANDLING? MY GRANNY DOES BETTER ERROR HANDLING THAN THAT..."

    horribly truncated sig:

    1. Re:He has a point... by Anonymous Coward · · Score: 0

      I guess we need a small army of exception-handling drill sergeants looking over code and yelling "YOU CALL THAT ERROR HANDLING? MY GRANNY DOES BETTER ERROR HANDLING THAN THAT..."

      OpenBSD Anyone?

  25. Well duh ... by Pushnell · · Score: 1

    You just gotta write software without any errors. Every good open-source programmer knows this.

    (j/k)

  26. Do you think commercial software handles errors... by MissMyNewton · · Score: 1
    Commercial software has errors?!!!

    No way! Who'd stand for that?!?!

    --

    ---

    Information wants...you to shut your pie hole.

  27. That all depends on your point of view by CmdrTroll · · Score: 1, Troll
    Most open source software is not designed to be used by the average, clueless user. It is designed to be used by experienced power users, who know the difference between right and wrong and don't do stupid things to upset the machine. Furthermore, Linux supplies many powerful diagnostic tools (gdb, strace, ltrace, dmesg, etc.) which would cost hundreds or thousands of dollars on other platforms (that means you too, Sun). Those tools are there for a reason: if you have an application failure, you will be able to figure out what caused it very quickly - IF you know what you're doing.

    For instance, I know many "average" users who eject floppy disks and CD-ROMs from the drive while they are being read. Any Linux user who tries a stunt like that deserves a seg fault (or worse). The more error-handling and anti-stupidity measures that are added to a piece of software, the less versatile that software is. Flexibility comes at the expense of simplicity, and lesser users do not deserve the rich functionality that open source has to offer if they do not know how to handle themselves with a computer.

    -CT

    1. Re:That all depends on your point of view by LordNimon · · Score: 3, Insightful
      Any Linux user who tries a stunt like that deserves a seg fault (or worse)

      And attitudes like that, ladies and gentlemen, are the reason why we're all going to be old and grey before Linux is accepted on the desktop.

      --
      And the men who hold high places must be the ones who start
      To mold a new reality... closer to the heart
    2. Re:That all depends on your point of view by Evangelion · · Score: 1


      You sir, write awesome trolls.

      You've made my day brighter just by being there.

      Thank you.

    3. Re:That all depends on your point of view by Anonymous Coward · · Score: 0

      "Note to ACs: I never read comments rated less than 1."

      Perhaps you should start. Perhaps more exposure to trolls would teach you how not to bite.

    4. Re:That all depends on your point of view by anti-drew · · Score: 0, Troll

      That's a lame excuse if I ever heard one.

      Human fallibility (operator error to you) is the norm, not the exception. And error handling applies to bugs as well as human error. And, even in Linux, you can't expect even an expert hacker to be an expert on EVERY piece of software on their computer. Nuclear physicists writing sophisticated entropy generators for /dev/random may not know enough to figure out what's gone wrong with their DHCP configuration under PPPoE.

      Even if the odds of a particular bug or error occurring are 10 million to 1, run the code frequently enough and someone is going to hit it. Trained engineers are aware of this. Hobbyists and part-time hackers often aren't.

      Nor is flexibility and functionality at odds with good error handling. Take a design class sometime!! Sheesh!

      -d

    5. Re:That all depends on your point of view by jrockway · · Score: 1

      Why is it so important to get Linux accepted on the desktop? I have all the programs that I need, and the Windows lusers (or whatever) have theirs. What's the problem?

      --
      My other car is first.
    6. Re:That all depends on your point of view by LordNimon · · Score: 1
      I have all the programs that I need

      That may change. Some day, there may be some new software or hardware that you want to have. The more people who use Linux, the more software and drivers there will be for Linux.

      --
      And the men who hold high places must be the ones who start
      To mold a new reality... closer to the heart
    7. Re:That all depends on your point of view by CyberKnet · · Score: 1

      I, for one, will not lament that possibility. Who ever said Linux needs to be on every desktop?

      --
      Video meliora proboque deteriora sequor - Ovidius
    8. Re:That all depends on your point of view by darkonc · · Score: 2
      THe cluelessness of an error response will change from programmer to programme, and even from progrm to program. Programs that I write will vary from a reasonably complete attempt to catch and explain errors to, through terse "bad stuff" messages to ignoring the error and producing (obviously?) bad results.

      The more likely that I think someone other than me is going to use a program, the more likely I'm going to put work into error support. If I'm expecting really techie types to use it, I may be more oriented to super-terse responses.

      For stuff that goes to the general public, I'm more likely to do nice error work, but even that may be cut short if I'm really short on time. Of course, there's the problem of systems that go are originally intended for me but then get released to an unintended audience... These are the ones most likely to have what I consider inappropriate error handling for the audience. I think that this re-targeting of programs originally intended for internal consumption are also the source of sub-optimal error handling in some open source programs.

      Some principles that I've learned for error reporting are (in roughly decresing order of importance);

      • it shouldn't do the unexpected in the face of the unexpected/unwanted
      • the response should be reasonable and predictable
      • error messages should indicate, as much as possible) where the error originated
      • recovery should be as easy as possible
      Now I think that I'm going to get flamed at for putting easy recovery at the end, but that's really where I have it. I'd rather have consistent and reasonable (but cryptic) responses than reall nice messages and eratic behaviour. If it happens with any regularity, I believe that eratic behavior is going to be more off-puting to users than terse messages.

      Now ideally, I'm going to achieve all of the above, but that's going to depend on how much time I have to put into the project in question. I guess that the listing I gave is the order in which I plan for error reporting depending on the 'techiness' of the expected user.. (This may also include the techniness of my own expected mood when I'm going to be running the program).

      To be honest, I believe that if other users are going to be playing with my program, it's usually worth my while to go the full gamut for error response/ recovery. I know that if I don't take the time to make error recovery as easy as possible, I'm ultimately going to end up spending more than that amount of time responding to users who don't understand/like the errors that they get out of my program.

      Short term investment, long term gain

      --------

      Microsoft has had a history of going to extremes with their error response. The response is either laking all but (possibly) the most basic error handling that may not even achieve my first intent (e.g. BSOD) to things like the paper clip that are so damned helpful that they're annoying. Part of the problem, I think, is that the Microsoft culture encourages it.

      When program failures are cryptic and unpredictable, it encourages support calls to Microsoft that they get paid for. Microsoft actually gets paid for. The other reasonable response is to go to microsoft for training -- once again paying them for an MSIE that spends lots of time on how to placate customer dissatisfaction with Microsoft's problems.. In other words, microsoft gets paid for bad programming practices.

      This seems to change, however, when Marketing decrees that problems need to be handled better. As far as I can tell, marketing seems to drive Microsoft, so when they decree that things need to change, they will.

      An early example of this was when windows 95 came out and decided to check the filesystem if the system was brought down badly. This was something that Unix and MAC boxes already did, and microsoft probably wanted to jump on the "stability bandwagon". The result was the annoying wait at the "we're about to clean the filesystem, you naughty boy" prompt.

      I expect that the paperclip was similarly mandated by Marketing (though I sometimes think that it may have started out as some programmer's prank and picked up by marketing as a 'good idea'). That feature was so annoying that it was ultimately dropped -- I think because it broke the principle of 'reasonable response'.

      Something that distracts the user isn't helpful. The constant (nervous) motion of the paper clip, and it's obtrusive location on top of the main screenare tricks learned by advvertisers to get peoples attention -- unfortunately, most of the time the users' attention is attempting to focus on the document being created. Had the paper clip been an unobtrusive text box in the toolbar, people probably would have welcomed it.

      In any case (having rambled), I think that Microsoft error responses are more oriented towards making money for Microsoft than making life easier for the user (a common subtext on slashdot).

      --
      Sometimes boldness is in fashion. Sometimes only the brave will be bold.
    9. Re:That all depends on your point of view by mmontour · · Score: 2

      For instance, I know many "average" users who eject floppy disks and CD-ROMs from the drive while they are being read. Any Linux user who tries a stunt like that deserves a seg fault (or worse)

      Well, an Amiga would give you a "You MUST replace volume &lt disklabel > in drive &lt device >!!!" if you ejected a disk while it was in use. It was a good reminder to the user that he had just done a Bad Thing, but the program could (usually) continue once it got the disk back. I don't think the application program even knew that this had happened; the read() call just blocked until the disk was put back.

      If the OS isn't able to handle this sort of situation, the application program should get an EIO error on its read(). However this shouldn't translate into a segfault. Nothing should translate into a segfault - at worst an abort() if the program doesn't feel like recovering from the error.

      Of course a "real OS" will just lock the CD-ROM or floppy drive [hardware permitting], thus preventing the user from ejecting a disk that's in use (unless the user has a paperclip, in which case he does deserve whatever he gets).

    10. Re:That all depends on your point of view by Anonymous Coward · · Score: 0
      Q. Why does Linux want popularity the desktop?

      A. Imagine what popularity would do to the hardware support under Linux. Imagine that we're not gonna get into the same situation twice and we'll have an open word processing format. Imagine widespread support.

    11. Re:That all depends on your point of view by elflord · · Score: 2
      And attitudes like that, ladies and gentlemen, are

      ... largely irrelevant if the only people who subscribe to them are slashdot trolls. Clearly, this is not the kind of viewpoints held by coders in the KDE and GNOME projects.

    12. Re:That all depends on your point of view by Anonymous Coward · · Score: 0
      When program failures are cryptic and unpredictable, it encourages support calls to Microsoft that they get paid for. Microsoft actually gets paid for. The other reasonable response is to go to microsoft for training -- once again paying them for an MSIE that spends lots of time on how to placate customer dissatisfaction with Microsoft's problems.. In other words, microsoft gets paid for bad programming practices.

      As an MS employee I can tell you that this is not true. Big corporate customers who buy licenses by the hundreds often do purchase premier support contracts as well, but those who do not buy such contracts do not pay for support calls -- which means the company foots the bill when Joe User picks up the phone for help, not just for the call itself, but also for the paycheck of the person answering the call. (Which is as it should be, IMHO)

      In fact, the number of calls generated by different products, and by features in those products, is a heavily tracked number because it is such a significant operating expense. At least part (I don't know the exact details) of these expenses are billed directly back to the product groups. So to say that MS gets paid for bad programming practices is patently false.

    13. Re:That all depends on your point of view by crucini · · Score: 1

      I don't think floppies will still be in use by the time most of us are grey.

    14. Re:That all depends on your point of view by crucini · · Score: 2

      I want Linux to continue to run on new, interesting hardware. There is an ongoing battle to get vendors to release their specs. There are also several ominous clouds on the horizon, SSSCA and TCPA (trusted computing platform architecture) which threaten to rain on our parade of cheap, open commodity hardware.

      If even a small percentage of "normal" users use Linux, it will be nearly impossible for anyone to marginalize Linux and lock it out of new hardware.

      Also, consider protocols. Imagine if Microsoft pushes us to a point where you need .NET to buy airline tickets, make hotel reservations, or file your tax returns. A substantial base of Linux users can apply enough pressure to keep these protocols open.

    15. Re:That all depends on your point of view by tuj · · Score: 0
      ... deserves a seg fault

      No software should seg fault ever, under any circumstances, ideally. But the idea that seg faulting on the user's action is totally unacceptable. That's basically like saying its ok a program crashes if you double-click on a radio button, because you are supposed to be smart enough to know not to do that.

      I have a hard time believing that no one has ever accidentally hit the cd eject button ever when a disk was being read. And what is "or worse"? Should we expect a total system crash rather than just a seg fault?

      Imagine if your car's engine exploded because you drove it on the wrong side of the road. Yeah, crazy analogy, but its a developer's responsibility to make software that doesn't break, no matter what the user does.

      "lesser users do not deserve the rich functionality that open source has to offer if they do not know how to handle themselves with a computer"

      Translation: Open source is only for computer science nerds, and will never be for children and old ladies who are both impatient and hit the disk eject button. Open source is only for elite geeks, who pride themselves on never making simple mistakes, who love to debug an application and fix the problems in it. Open source is for people who build cars for free, talk all day about how their cars are so vastly superior, and then, when they let an "average user" test drive one, the engine explodes, the wheels fall off, and the open source guru must pullout his GNU Craftsman toolkit and find the problem, which turns out to be that the "average user" couldn't drive very well, so his car deserved to fall apart.

      You want to see Linux in schools? You want to see it on the average desktop? Then don't tolerate application crashes. But especially don't tolerate the attitude that any application crash is ok. Its not. Flexibility and proper error handling are no where near mutually exclusive.

    16. Re:That all depends on your point of view by BJH · · Score: 1

      Oh my God! Just think of that! Normal users not paying for support!

      Since Microsoft is on the brink of bankruptcy, you'd better do something about the situation right away.

      BTW, your response explains why the support MS offers to normal users is so awful. I have yet to hear of a person who called MS support with anything more than a utterly trivial question that was able to get an answer out of them.

    17. Re:That all depends on your point of view by SComps · · Score: 1

      Amen! Finally somebody who actually cares about the quality and usability of a product in general. It may be an old saw, but Quality does have to be at the beginning and end of everything. As long as open source has the opinion that "the user will fix it" it'll never be any better than Microsoft, but will always be the "joke" or "toy" operating system.

      Lets face it.. spending two days trying to get X11 to function with relatively current hardware is stupid. Having to boot into windows to search a crapload of poorly written web pages (that can't be viewed in lynx) to find ONE piece of information to GET it to work is even more stupid.

      OSS will always be behind the power curve on hardware so I'm not asking for a windows-esque install procedure. But a bit more help past "Device not present" is required. If the OS install can find the device enough to make a pretty graphical process of installing, one would thing the actual program used would be able to do it too.. Maybe I'm just crazy and you folks can flame/mod the hell out of me. I'm both a geek and a user. Sure I take the challenge of fixing this stuff *if* I can, but I'm also a user that gets frustrated at having to fix crap I shouldn't have to. If I download beta software I expect glitches, if I get alphas I expect crashes. If I download a release or final.. I expect it to friggin work. I don't want to chase down through dependency hell, nor do I want to pour through 15 directory levels of source code and README's to find out I need one or more *.so.1's from some obscure library the programmer used during development and didn't bother to tell me about upfront.

      Yeah I'm whining. I'm whining because I have three linux machines in my house and my kids can't use a single one of them unless I'm standing right here to help them when the damn software blows up in their face. I feel like a traitor for having a Windows 98 partition on the same machine as my linux workstation... I have to though. I'd like my kids to be able to use the machine on their own. When they get older and more savvy (yeah I said the word) maybe they'll decide to spend more time in a vastly superior OS. On the other hand I can't blame them for mousing around with software that *generally* works as planned.

      Flame on folks! Take your best shot. You can't hit me with any shot I've not already tossed at myself.

    18. Re:That all depends on your point of view by Anonymous Coward · · Score: 0

      s/lynx/links/g

      Lynx is past its prime. Given its spotty security history, almost nonexistent support for frames and tables, and lack of mouse support, I can't see any reason why anyone would use it over Links, w3m, or even GET. Lynx deserves a proper burial.

    19. Re:That all depends on your point of view by Anonymous Coward · · Score: 0

      Really? You've got a proper web browser?

      Note that those pieces of filth, Netscape, Mozilla, Opera, Lynx and Konqueror do not count. They are not web browsers, they are digital mistakes.

    20. Re:That all depends on your point of view by Procrasti · · Score: 1

      Any Linux user who tries a stunt like that deserves a seg fault (or worse)

      This is something that annoys me - programs that just go 'Segmentation Fault' in the night... What do you do with a seg fault? How do you find the cause of a seg fault? What causes them? Unmatched libraries and application code? Null / Uninitialised pointer exceptions?

      If anyone can enlighten me, I'd really appreciate it. Gabber was giving me the old seg fault, and that's just not enough information to fix it!

      Cheers!

    21. Re:That all depends on your point of view by mr3038 · · Score: 2
      This is something that annoys me - programs that just go 'Segmentation Fault' in the night... What do you do with a seg fault? How do you find the cause of a seg fault? What causes them? Unmatched libraries and application code? Null / Uninitialised pointer exceptions?

      I take that you're using Linux or something similar. Suppose you were running ./foo and it went belly up (core dumped). Simply "gdb ./foo core" and you can see what the program was doing when it died. Usually simple "bt" for backtrace is enough to find the reason. If you didn't get core file you might want to check your limits (man ulimit). Usually segmentation fault is caused by incautious pointer usage - programmer made a copy of pointer and used it after original resource was freed or something like that. If you see segmentation fault in malloc() you can be pretty sure that the problem is some extra free().

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
    22. Re:That all depends on your point of view by mr3038 · · Score: 1

      I don't think floppies will still be in use by the time most of us are grey.
      I hope floppies will not still be in use by the time most of us are grey.

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
    23. Re:That all depends on your point of view by QuickFox · · Score: 1

      Why is it so important to get Linux accepted on the desktop?

      To diminish M$ oligopoly. With a single company registering more than a hundred million users in their Passport system, potentially able to control people's software use, etc, this is becoming very important.

      It boils down to what kind of society you want. M$ isn't a democracy, you don't get to vote there. Only democracies should have the kind of power M$ is getting. Not even democracies in many cases. (Depending on what society you want, of course.)

      Give a man a fish, and you have fed him for one day. Give him one fish every day, and you can control him for a lifetime. -- M$ Strategy Department.

      --
      Terrorists can't threaten a country's freedom and democracy. Only lawmakers and voters can do that.
    24. Re:That all depends on your point of view by jrockway · · Score: 1

      M-x w3c works fine ;)

      --
      My other car is first.
  28. yes, and most programmers suck by daveking · · Score: 2, Insightful

    which is why Open Source is required. So we can all see exactly where the code stinks and we can fix it. Too bad legacy development models don't provide such advantages. Wouldn't it be cool if you could just buy quality software?

    --
    ------DO NOT WRITE BELOW THIS LINE------
    1. Re:yes, and most programmers suck by jaoswald · · Score: 1

      This is completely impractical. Most of the time, bad error handling is a cancer that afflicts the whole application. Open source isn't much help when it takes a whole re-write to do things right.

    2. Re:yes, and most programmers suck by MrBlack · · Score: 2

      I love the term "Legacy Development Models" - I'm gonna try and use that one today at our meeting.

  29. So what? by lkaos · · Score: 1

    Ok, this article is not negative towards open source programmers, but to programmers as a whole. This guy has the nuts to say that most programmers don't handle error conditions very gracefully.

    Unfortunately he is correct. There are a great deal of programmers that just do not know what they are doing. That's life though, and that's also why the goods ones get paid so well...

    So lets encourage bad programmers to write lots of bugs so that the good programmers can get paid lots of money to be on tiger teams to fix the high priority problems introduced by the moron developers.

    --
    int func(int a);
    func((b += 3, b));
  30. All Programmers suck at error handling by HeTTaR · · Score: 1

    I am a commercial programmer and in general unless
    it is a critical section of code I am yet to meet
    a programmer who does do all the checks they should. I know I never do. I think it has to do with out belief that "ahh that will never happen"
    which of course it always does =o). I do however
    think the OS software gets better tested and as a
    result the error checks will eventually get put in or the errors will go away and the will not happen.

    --
    Hettar.
  31. Errorhandling... by geggibus · · Score: 1

    Real programmers....

    OR

    Error handling.. nah.. no stupid users entering monkeydata couldn't install this... ;)

    /K

  32. depends on your perspective.. by greysky · · Score: 1

    I've found that most open source software that is pre- release1.0 does do a shoddy job of handling error. But then again so does every piece of beta-test commercial software I've ever seen. Most of the better written open source software I've used that has reached version 1.0 does handle errors well. Look at programs like the GIMP, OpenOffice, Apache and vim. They all do a good job with errors -- you know what went wrong and usually why.

  33. For for? by Chagrin · · Score: 1
    • Mark Cappel writes: "LinuxWorld columnist Nick Petreley has a few choice words for for the open source community in "Open source programmers stink at error handling. Do you think commercial software handles errors better?"
    Does he have any choice words for for lack of proofreading? (note also the unclosed double-quote)
    --

    I/O Error G-17: Aborting Installation

  34. Too specific: Programmers Stink at Error Handling by victim · · Score: 3, Insightful

    I was just re-re-reauthenticating my Cubase installation. The key CD is now scratched which hangs the authenticator forced a quite ungraceful reboot and corrupted my hard drive. (Perhaps a $150 upgrade will help. I'll never know.)

    The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file. (I will not use it again.)

    My HP PSC 750xi software informs me every morning that its controlling software was exploded and I should reboot the host computer. (I'll wait for the OS-X drivers. If they are still bad the PSC goes out the door.)

    The most amazing part is that this state of affairs doesn't surprise me. If my refrigerator intermittently defrosted and melted icecream all over the kitchen I'd be ticked. If my car mysteriously dies at stop signs I get it fixed.

    Programmers have managed to beat down everyone's expectations to the point where half-assed is pretty good.

    The only way I see to fix it is for consumers to refuse to buy flawed products, or legislators to pass laws allowing redress for flawed products.

    I don't think either is likely.

    I now use OSS for my mission critical work and fix what needs it.

  35. I have one thing to say: by nahtanoj · · Score: 1

    Commmercial: "This program has performed an illegal operation...

    Open Source: "Segmentation fault. core dump.

    Ciao

    nahtanoj

    1. Re:I have one thing to say: by loconet · · Score: 1

      Commercial:
      buff=(char*)malloc(buffsize+1);
      if(!buff)
      while(!buff) {
      /*some how the code below should eventually sove the problem*/
      show_bsod();
      }

      Open Source:
      buff=(char*)malloc(buffsize+1);
      if(!buff) {
      perror("malloc");
      exit(1);
      }

      --
      [alk]
  36. Don't hide behind that. by Anonymous Coward · · Score: 0

    "Do you think commercial software handles errors better?"

    What's that got to do with it? Either its right or it's not, regardless what commercial software does.

  37. What's the point... by Coniine · · Score: 2, Interesting

    of handling errors that should never happen? You just double the size of your code, cause schedules to be missed, make maintenance more difficult and increase the probability of a grotesque coding error. I expected more macho stuff from the slashdot audience, not namby pamby whimpering! Sheesh! Welcome the the real world, get a thicker skin man!

    8)

    On a serious note : I've written commercial and non-commercial code. Sometimes I'm obsessive about completeness, sometimes I'm pragmatic. No point in generalizing about OSS vs. commercial.

    1. Re:What's the point... by fling93 · · Score: 1

      "What's the point... of handling errors that should never happen? You just double the size of your code, cause schedules to be missed, make maintenance more difficult and increase the probability of a grotesque coding error."

      Well, I know you were being humorous, but the point wasn't about errors that weren't happening, but about errors that *were* happening that the developer assumed would never happen.

      Most of these projects are pretty complicated; your individual module interacts with a bunch of other modules (software or otherwise) written by other people who may not give your module valid inputs. In my experience, if you check all your inputs, these bugs'll be found faster, the project as a whole will be more maintainable, and grotesque coding errors will be caught faster.

      So basically, those typical excuses only come from namby pamby programmers. :)

    2. Re:What's the point... by Coniine · · Score: 1

      /*
      Well, I know you were being humorous, but the point wasn't about errors that weren't happening, but about errors that *were* happening that the developer assumed would never happen.
      */

      Well, sure, I was just phrasing things that way because I've lost count of the number of times I've inherited code with a conditional block for detecting and handling an error condition that simply contained a comment like :

      /* this shouldn't happen */

      Part of my standard procedure for handling incoming Other People's Code is to grep for :

      kluge, kludge, hack, temporary, later, fix

      You get the picture.

  38. slashdot effect - slashdot mirror by TV-SET · · Score: 5, Informative

    I guess if /. killed the site, it should mirror it :)
    Here is a select-n-middlemousebuttonclick(with my formatting):

    Title: Open source programmers stink at error handling.

    Outline: Commercial programmers stink at it too, but that's not the point. We should be better.

    Summary: Why are we subjected to so many errors? Shouldn't open source be better at this than commercial software? Where are the obsessive-compulsive programmers? Plus, more reader PHP tips. (1,400 words)

    Author: By Nicholas Petreley

    Body: (LinuxWorld) -- Thanks to my very talented readers I've been able to start almost every recent column with a reader's PHP tip.I'm tempted to make it a regular feature, but with my luck the tips would stop rolling in the moment I made it official.So I want you to be aware that this week's tip is not part of any regular practice. It is purely coincidental that PHP tips appear in column after column. Now that I've jinx-proofed the column, I'll share the tip.

    Reader Michael Anderson wrote in with an alternative to using arrays to pass database information to PHP functions. As you may recall from the column Even more stupid PHP tricks, you can retrieve the results of a query into an array and pass that array to a function this way:

    <?PHP
    $result = mysql_query("select name, address from customer where cid=1");
    $CUST = mysql_fetch_array($result);
    do_something($CUST);
    function do_something($CUST) {
    echo $CUST["name"];
    echo $CUST["address"];
    }
    ?>

    Michael pointed out that you can also retrieve the data as an object and reference the fields as the object's properties. Here's the above example rewritten to use objects:

    <?PHP
    $result = mysql_query("select name, address from customer where cid=1");
    $CUST = mysql_fetch_object($result);
    do_something($CUST);
    function do_something($CUST) {
    echo $CUST->name;
    echo $CUST->address;
    }
    ?>
    I can't help but agree with Michael that this is a preferable way to handle the data, but only because it feels more natural to me to point to an object property than to reference an element of an array using the string name or address. It's purely a personal preference, probably stemming from habits I learned using C++.

    Subtitle: OCD programmers unite

    Nothing could be a better segue into the topic I had planned for this week. I'm thinking about starting a group called OLUG, the Obsessive Linux User Group. Although I know enough about psychology to know I don't meet the qualifications of a person with full-fledged OCD (Obsessive-Compulsive Disorder), I confess that I went back and rewrote my PHP code to use objects instead of arrays even there was no technical justification for doing so.

    Certain things bring out the OCD in me. Warning messages, for example. It doesn't matter if my programs seem to work perfectly. If a compiler issues warnings when I compile my code, I feel compelled to fix the code to get rid of the warnings even if I know the code works fine. Likewise, if my program generates warnings or error messages at run time, I feel driven to look for the reasons and get rid of them.

    Now I don't want you to get the wrong impression. My PHP and C++ code stand as testimony to the fact that my programming practices don't even come within light years of perfection. But just because I do not live up to the standards I am about to demand isn't going to stop me from demanding them. It's my right as a columnist. Those who can, do. Those who can't, write columns.

    I'll be blunt. Open source programmers need to stop being so darned lazy about error handling. That obviously doesn't include all open source programmers. You know who you are.

    If you want a demonstration of what I mean, start your favorite GUI-based open source applications from the command line of an X terminal instead of a menu or icon. In most cases this will cause the errors and warnings that the application generates to appear in the terminal window where you started it. (There are exceptions, depending on the application or the script that launches the application.)

    Many of the applications I use on a daily basis generate anywhere from a few warnings or error messages to a few hundred. And I'm not just talking about the debug messages that programmers use to track what a program is doing. I mean warning messages about missing files, missing objects, null pointers, and worse.

    These messages raise several questions. Doesn't anyone who works on these programs check for such things?Why do they go unfixed for so long? Are these problems something that should be of concern to users?Worse, what if these messages appear because of a problem with my installation or configuration, and not because the program hasn't been fully debugged?But even if it is my installation that is broken, shouldn't the application report the errors? Why do I have to start the application from a terminal window to see the messages?

    Subtitle: Getting a handle on errors

    At first I wondered if this was a problem that you would be more likely to find when developers use one graphical toolkit rather than another. But I see both good and bad error handling no matter which tools people use. For example, the GNOME/Gtk word processor AbiWord has been flawless lately. Not a single warning or error message appears in the console. It's possible that AbiWord simply isn't directing output to the console, but I'm guessing that it's simply a well-tested and well-behaved application.

    On the other hand, GNOME itself has been a nightmare for me lately. At one point I got so frustrated that I deleted all the configuration files for all of GNOME and GTK applications in my home directory in disgust, determined never to use them again. When I regained my composure and restarted GNOME with the intent of finding the cause of the problems, the problems had already disappeared. Obviously one or more of my configuration files had been at fault. Which one, I may never know, because GNOME or some portion of it lacked the proper error handling that should have told me.

    In this case I was lucky that the problems were so bad I lost my temper and deleted the configuration files. In most cases, the applications appear to function normally. Aside from being ignorant of any messages unless you start the application from a terminal, there's no way of knowing why the warnings exist, or if they are cause for concern. The warnings could be harmless, or they could mean the application will eventually crash, corrupt data, or worse.

    Subtitle: Examples

    Just so you know I'm not making this up, here are some samples of the console messages that appeared after just a couple of minutes of toying with various programs. By the way, did you know you can actually configure the Linux kernel from the KDE control panel? Bravo to whoever added this feature. Nevertheless, when I activate that portion of the control panel, I get the message:

    QToolBar::QToolBar main window cannot be 0.

    Is there supposed to be a toolbar that isn't displayed as a result? I may never know.

    The e-mail client sylpheed generates this informative message after about a minute of use:

    Sylpheed-CRITICAL **: file main.c: line 346 (get_queued_message_num): assertion `queue != NULL' failed.

    The Ximian Evolution program generates tons of warnings, but most are repetitions. They begin with the following:

    evolution-shell-WARNING **: Cannot activate Evolution component -- OAFIID:GNOME_Evolution_Calendar_ShellComponent
    evolution-shell-WARNING **: e_folder_type_registry_get_icon_for_type() -- Unknown type `calendar'
    evolution-shell-WARNING **: e_folder_type_registry_get_icon_for_type() -- Unknown type `tasks'

    The KDE Aethera client generates even more warning messages than Evolution, but many of them are simply debug messages about what the program is doing. By the way, I finally figured out why I couldn't login to my IMAP server with Aethera. The Aethera client couldn't deal with the asterisks in my password. I could log in after I changed my password, but I still can't see my mail. The program simply leaves the folder empty and says there's nothing to sync. Here are just a few of the countless warnings I get from Aethera, including the sync message.

    Warning: ClientVFS::_fact_ref could not create object vfolderattribute:/Magellan/Mail/default.fattr
    Reason(s): -- object does not exist on server
    Warning: VFolder *_new() was called on an already registered path
    clientvfs: warning: could not create folder [spath:imap_00141, type:imap]
    RemoteMailFolder::sync() : Nothing to sync!

    The spreadsheet Kspread reports these errors all the time, even though what I'm doing has nothing to do with dates or times:

    QTime::setHMS Invalid time -1:-1:-1.000
    QDate::setYMD: Invalid date -001/-1/-1
    The e-mail client Balsa popped up these messages just moments after using it:
    changing server settings for '' ((nil))
    ** WARNING **: Cannot find expected file "gnome-multipart-mixed.png" (spliced with "pixmaps") with no extra prefixes

    The Gnumeric spreadsheet only reported that it couldn't find the help file, as shown below:

    Bonobo-WARNING **: Could not open help topics file NULL for app gnumeric

    Many of these problems could easily have been handled more intelligently. For example, Gnumeric could have asked for the correct path to the help file, perhaps adding an option so a user can decide not to install the help files and disable the message. Unless GTK and Bonobo are a lot more complicated than they should be, it should be easy to create a generic component for handling things like this and then use the component to handle all optional help files as a rule.

    The only conclusion I can draw is that, like most commercial software developers, many open source programmers are just plain lazy about proper error handling. But we're supposed to be better than that, and it's time we started to live up to the reputation. I realize that most of these programs are works in progress. But good error handling is not something that should be left for last. It should be part of the development process. Although I may not practice it myself, I'm not the least bit ashamed to preach it.

    --
    Leonid Mamtchenkov ...i don't need your civil war...
    1. Re:slashdot effect - slashdot mirror by geekd · · Score: 1

      Apparently, LinuxWorld programmers stink at load handling, since, as you said, it is slashdotted.

    2. Re:slashdot effect - slashdot mirror by BlowCat · · Score: 2
      The funniest error message that I've ever seen was

      expect unexpected

      Actually, the message was telling me that the keyword "expect" was not expected to be in that position.

  39. Nick Petreley is a moron... by ryanwright · · Score: 3, Insightful

    Nick Petreley is a moron. Intelligent people don't make blanket statements like "Open source programmers stink at error handling." Next thing you know, he'll be telling you "Closed source programmers use more descriptive variables." How the hell does he know?

    Programming traits - just like preferences for pizza toppings, frequency in bathing and type of pr0n - vary from programmer to programmer. Some implement proper error handling, others could care less. It doesn't matter whether they're working on an open or closed source project. If the open-source programmers all traded places with the closed-source programmers, you'd have the same ratios of proper vs. improper error handling (although the traffic from open-source-programmers.com to goatse.cx would probably spike).

    --
    -Ryan, with the unoriginal sig
    1. Re:Nick Petreley is a moron... by jedwards · · Score: 1

      He's not making blanket statements.

      For example he points out that AbiWord does not produce lots of worrying error messages from the shell.
      And that there is a lot of evidence that error handling is not being implemented properly.

      Or that warning messages are generated when inappropriate -

      RemoteMailFolder::sync() : Nothing to sync!

      If nothing to sync is bad, then tell the user their mail is bad, or their config is wrong.
      If nothing to sync is harmless (because there's no new mail for example) then why bother printing the message and confusing/scaring the people that do see it.

    2. Re:Nick Petreley is a moron... by xmedar · · Score: 2

      Remember M$ putting in non-fatal error messages in Windows to kill off DRDOS? If you don't read this

      --
      Any sufficiently advanced man is indistinguishable from God
    3. Re:Nick Petreley is a moron... by Anonymous Coward · · Score: 0

      Petreley rode into a regular column on the back of the Linux boom. Frankly, every column I've ever read of his is full of ignorant bullshit.

      Read some of his other columns... grand pronouncements about programmers/programming, when the most advanced thing he's ever written is a shitty quiz program for Qt. It's liek some Visual Basic weenie lecturing on the benefits of object oriented design.

    4. Re:Nick Petreley is a moron... by Anonymous Coward · · Score: 0

      That error was fatal, gritsboy.

    5. Re:Nick Petreley is a moron... by krokodil · · Score: 2

      I have some news for you: most open source programmers are closed source programmers as well (during their day jobs). Except few lucky ones who are working for open-source companies.

      So error handling level is about the same, thoug
      vary for programmer to programmer.

    6. Re:Nick Petreley is a moron... by Phil+Wherry · · Score: 1

      I'd trade a lot of errors from open source software for a few errors from closed-source any day.

      While it might well be true that open source programmers are a bit more sloppy in error checking, I've found it's far more likely that the closed source counterparts will handle errors in an inscrutable way.

      Case in point: I installed some antivirus software yesterday. As it turned out, I was missing a subtle but important network mapping. With an open source package, I'd probably have figured the problem out pretty quickly from the error messages. As it was, though, I was faced with the error message: "An installation error occurred. [OK]". That's it; I got no further help at all. While it's not universally true, I suppose, it's very rare to get such useless messages from open source software!

    7. Re:Nick Petreley is a moron... by wljones · · Score: 1

      I have read Nick Petreley for years, and say he is not a moron. His complaints about poor error handling in open source code are backed by samples. I feel that the messages I get with open source are much more helpful than the dumb messages from Bill's bloatware that tell me that my program has performed an illegal operation and will shut down. He did not speak of the shoddy and missing error handling in commercial bloatware, only showed where open source programmers need to clean up their act. He also did not point out the obvious, that error messages are still light years ahead of the blue screen of death and boxes that accuse users of being criminals without telling the programming cause of the problem.

    8. Re:Nick Petreley is a moron... by sir99 · · Score: 1

      This is surely redundant, but...(-1: Didn't read the article)

      --
      The ocean parts and the meteors come down
      Laid out in amber, baby.
  40. stop panicking! by DeadPrez · · Score: 2, Interesting

    Out of all open source software I use, my biggest complain is with Linux and how freaking hard it is to swap a hard drive to a new machine. I can only imagine the insults that will be thrown my way but 98, or even NT/2000 nine times out of 10 I will have no problem with this. Sure it takes about 30 minutes of clicking yes, install new hardware but it works (usually). Under Linux, can't load root fs, goto panic. Grr, that bugs me like nobodies business.

    I am sure there is some semi-painful way to get around this but should I really have to? If you ask me, the kernel should not panic at this "error" and should recognize it, prompt you and try to solve it (probe the new hardware and load the correct module(s)). Maybe some distros are better than others (and I shouldn't be placing this "blame" on the kernel team).

    1. Re:stop panicking! by Anonymous Coward · · Score: 0

      Hmmm..sounds more like the kernel was panic'ed about the drive controller, not the drive. The only thing I can suggest is to rebuild the kernel on the old box prior to moving the drive so that all the hardware in the new box is builtin or module'd so that the kernel can load all the drivers it needs, especially the mainboard, disk and video controllers.

    2. Re:stop panicking! by Trelane · · Score: 1

      The kernel has to know where the root partition is. The information is stored in the kernel (and in lilo.conf). However, when you swap disks around, this can change. To get back in, you need to tell the kernel where the root parition is. To do this, either wait for the LILO prompt to come up, or pop in your rescue floppy, reboot, and type the following in at the LILO prompt:

      boot linux root=newroot

      [newroot is the new device holding your root partition, named via the standard Linux naming scheme.]

      You should be able to get in then. See LILO documentation on all the nifty things you can do with it.

      --

      --
      Given enough personal experience, all stereotypes are shallow.
    3. Re:stop panicking! by sirsnork · · Score: 1

      Actually. Both 2000 and XP will not move to a new motherboard UNLESS the IDE Controller is the same and the North Bridge is the same make. You either get Inaccessable boot device or an obscure memory dump.. On the other hand if you compile your kernel with support for a lot of IDE controllers and run i386 code without optimization you should be able to move the drive to pretty much and machine you want. Assuming it's the same architecture

      --

      Normal people worry me!
    4. Re:stop panicking! by Anonymous Coward · · Score: 0

      Enjoy it while it lasts with Windows.
      You'll need to go through Reactivation if you try drive swaping with XP.

      But I certainly see your point.
      It would be nice if lilo could just detect bootable partions, and offer those as boot options.

    5. Re:stop panicking! by Anonymous Coward · · Score: 0

      So use a BSD, they prompt you for a root-device if they can't find it on their own.

      (The boot will of course fail and dump you in single-user mode, but that's no worse than windows, if you know what you are doing at all..)

    6. Re:stop panicking! by Anonymous Coward · · Score: 0

      I'm mystified by your comment. I install linux on machines without CD-roms by swapping hard drives and running lilo (from a floppy) on the new machine. where are you having trouble?

  41. That's interesting, but how? by Perianwyr+Stormcrow · · Score: 2

    I always have inaccessible boot device bluescreening problems under 2000. 98 does happily accept the other drive, but win2k seems to get far angrier. Perhaps I am missing something?

    --

    What we call folk wisdom is often no more than a kind of expedient stupidity.-Edward Abbey

  42. Slashdotted! by Anonymous Coward · · Score: 0

    Slashdotted already? Guess that's what you
    get for running a www server on Linux. If only
    the used a BSD instead.

  43. Last gasp error handling. by Black+Parrot · · Score: 2


    Over the past few years I've used several OSS programs in pre-release versions, and the tendency I observed was for the programmers to provide "last gasp" file saves to keep you from using work when the program crashed. For instance, I never lost a keystroke when using early versions of LyX.

    I don't recall ever seeing this in a commercial product, though I haven't used any commercial products to speak of lately, so perhaps the state of the art has changed. I sure used to lose a lot of work under commercial software, though.

    --
    Sheesh, evil *and* a jerk. -- Jade
    1. Re:Last gasp error handling. by Zurk · · Score: 1

      i'll second this. ive had word die on me dozens of times loosing data. i've always seen most OSS software to save the file "before" and "after" versions in case it died. emacs and pico are two common examples of text editors where you simply dont loose your work which IMHO is the highest goal a piece of software can achieve.

    2. Re:Last gasp error handling. by damiam · · Score: 1

      AbiWord does the same thing.

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    3. Re:Last gasp error handling. by Anonymous Coward · · Score: 0

      MS Word just got this... and now they're touting the "new feature" of not losing your work.

      Golly, I'm so glad to have MS leading the industry with its innovative software.

    4. Re:Last gasp error handling. by flegged · · Score: 1

      Real software does this too. If 3dsmax 4 crashes, it lets you save the file (it only ever crashes when using Brazil, which is prerelease).

      --

      "I think he was truly surprised at how little I cared about how big a market the Mac had" - Linus on Jobs
    5. Re:Last gasp error handling. by Ayende+Rahien · · Score: 2

      No, it had it since 95 (ver 6 or so, I think) at least, and probably before it.
      They just never advertised it so much.

      --

      --
      Two witches watched two watches.
      Which witch watched which watch?
  44. What a load of shit by Anonymous Coward · · Score: 0

    Anyway, he's got the source, why not fix it.

  45. Nothing beats X-Box's error handling! by ekrout · · Score: 2

    See my .sig for linkage!

    --

    If you celebrate Xmas, befriend me (538
  46. Hugh Daniels would agree with you... by pwagland · · Score: 1

    At HAL earlier this year Hugh Daniels said pretty much the same thing. For those who don't know, hugh Daniel is the guy who heads up the FreeS/WAN project. Anyway, his basic take on the situation is that error handling is what is placed in that last 10% of the famous 90/10 split.

    You know, getting it to work roughly is 90% of the job, and can be done in 50% of the time. Getting it to work properly all of the time is the last 10% and that takes the last 50%.

    The problem as I see it is that all too often open source software is created to "scratch an itch". When used "according to the instructions", or as the original author used it, it will normally work OK. It is only once you get into the realms of unorthodox usage that it causes problems.

    Hmm. Sounds like microsoft! ;-)

    Anyway, it is not endemic to either open or closed source, but it is endemic to under resourced projects. I have worked on commercial projects where every i was dotted, and every t was crossed. i have also worked on projecls where lhis was nol lhe case.... The primary difference between the two was the amount of time that i was given.

    The very same holds true for open source. The bigger projects with more developers, ie. samba, gimp, the kernel(s), tend to be quite good. the smaller projects, ie. psinfo, ls, tend to be quite good. But often when you get between those two it is a whole different kettle of fish.

    BTW. Hugh Daniel did not only complain about lack of error handling, but also the poor quality of error handling. And this is endemic. Basically this boiled down to "OK, so something is wrong, why havne't you told me possible ways to fix this?"

    1. Re:Hugh Daniels would agree with you... by ahem · · Score: 1

      I thought the quote was that getting it to work is 20% of the project and takes 80% of the time. The other 80% of the project is getting it to work right, and that also takes 80% of the time.

      --
      Not A Sig
    2. Re:Hugh Daniels would agree with you... by Anonymous Coward · · Score: 0

      > BTW. Hugh Daniel did not only complain about lack of error handling, but also the poor quality of error handling. And this is endemic. Basically this boiled down to "OK, so something is wrong, why havne't you told me possible ways to fix this?"

      Agreed. One of the things I *really* like about using apt-get is that if it fubars for some reason, it suggests a method to get rolling again, and the suggested method works 19 out of 20 times.

      Then there's vlc, which complains that it can't make sound from my playing DVD due to a missing plugin, but won't suggest what library (or better yet, package!) it expected to find. GRRRR.

    3. Re:Hugh Daniels would agree with you... by RetroGeek · · Score: 1

      Which would prove that most projects are 60% over time....

      --

      - - - - - - - - - - -
      I am a programmer. I am paid to produce syntax not grammar. Deal with it.
  47. It's Right! by mscout1 · · Score: 0

    I just can't handle errors! That's why I use linux instead of windows!

    --
    ------- I saw a VW Beatle the other day. The vanity Plates said "FEATURE"
  48. Re:That all depends on... your selection of course by ChrisBennett · · Score: 1
    When was the last time Windows gave you a nice error.log when it blue-screened, or how about IIS on a buffer overflow?
    In Windows 2000, you can configure the system to write a mini, kernel, or complete memory dump to %SystemRoot%\MEMORY.DMP on fatal errors. I have never tried this though.

    As for IIS, that buffer overflow you mention is "completely theoretical", and consequently I don't think IIS has any reporting of this type.
  49. You know by sllort · · Score: 0

    Sometimes a picture is worth 1000 words. Or 1000 slashdot posts.

    1. Re:You know by Anonymous Coward · · Score: 0

      Hey, that's a good one. I'm so used to reseting my PC when I see that. Well, let's just say I'm coming back from resetting!

  50. Commercial = Competition = Usability by nihilvt · · Score: 2, Insightful

    It seems a lot of open source programs do in fact have little error handling. Most open source programs seem to focus on functionality, rather than usability. It gets you from point A to point B, and doesn't give you much help in between. If the user is not a master programmer, any errors usually end up being cryptic and nonsensical. It seems that a lot of commercial software has decent error recovery, and prevents user error effectively. Now I know there are many exceptions, but I think it simply has to do with the fact that commercial programmers get paid to do their work, and competition forces companies to put out products that are competitively usable.

  51. How about Apple? by bluntmanspam · · Score: 1
    Typical Macintosh error - "I/O (Type -36) Error" Which means "Cannot read file", but you have to do a web search, or tech support call to find that out.

    Seriously, I once booted a Macintosh and the only thing that came on the screen was a little "Sad Macintosh." Apparently means that your system folder is corrupt. How's that for error handling?

    Want to see more? Try this Mac troubleshooting guide. [yale.edu]

    1. Re:How about Apple? by Phroggy · · Score: 2

      Seriously, I once booted a Macintosh and the only thing that came on the screen was a little "Sad Macintosh." Apparently means that your system folder is corrupt. How's that for error handling?

      Actually the Sad Mac usually indicates hardware failure (failed POST). You'll notice a hex code underneath the icon; the hex code indicates the actual error. One of the reasons it doesn't give plain English errors is, the Sad Mac is in the ROM. Text strings would take more space (think back to 1984 when that was an issue). Also, the Mac hardware isn't supposed to be language-specific (notice that there are no text labels on the ports) - if English isn't your native language, you shouldn't have English error messages. On top of that, Apple originally intended the Mac not to be user-serviceable. If you got a Sad Mac, you were supposed to take it into an Apple-authorized repair center and have an Apple-certified technician (who would have a list of error codes) take a look at it.

      Fortunately, Apple has changed their attitude, but the legacy Sad Mac remains. Personally I agree with you, it would be really helpful to have some idea of what the problem is without having to look up a number.

      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  52. s/Open source// by Anonymous Coward · · Score: 0

    Programmers stink at error handling. Most programmers stink at prgramming, for that matter, and error handling in particular is something that people give little attention to. It takes a lot of expereince and effort to develop good error-handling discipline.

  53. Excpetions are a key by ftobin · · Score: 3, Informative

    Exceptions are mandatory for good programming, period. If the language you are using doesn't support exceptions (C, Perl, etc), you are going to have problems. Exceptions make sure that if an error occurs, and you aren't aware of it, your program dies, and doesn't go on its merry way, causing a security hole/unstable software.

    Perl's hack at exceptions using 'die' doesn't cut it; one important thing about implementing exceptions is that your base operations (e.g., opening files, and other system functions) need to raise exceptions when problems occur. If this doesn't happen, you're only going to struggle in vain to implement good, correct code.

    Exceptions are a primary reason I've moved from Perl to Python. Python's exceptions model is standard and clean. Base operations throw exceptions when they occur problems. And my hashes no longer auto-vivify on access, thank goodness. Auto-vivification on hash access are probably one of the principle causes of bad Perl code.

    1. Re:Excpetions are a key by NerveGas · · Score: 2

      Interesting. I've never run across an example of using exceptions that can't be done more cleanly, quickly, and efficiently by simply using (and checking) result codes.

      To show that there's been an error, I'd much rather do this:

      return undef;

      than this:

      raise Exception.Create('This didn't work');

      And to check for an error, I'd MUCH rather do this:

      die unless defined(do_something);

      than this:

      try
      do_something
      except
      on e.excpetion do
      exit;
      end;
      end;

      In fact, the programmers that I've seen use exceptions tend to be less careful than those that simply check result codes.

      steve

      --
      Oh, you're not stuck, you're just unable to let go of the onion rings.
    2. Re:Excpetions are a key by gizmo_mathboy · · Score: 2

      Exceptions are mandatory for good programming, period. If the language you are using doesn't support exceptions (C, Perl, etc), you are going to have problems.

      Well, you haven't seen Error.pm yet. It implements exceptions for Perl.

      I'm not totally convinced that exceptions are necessary for good programming. A good programmer should know how to do error handling. It's nice to be able to call upon it when you need it but it should not be forced upon you, kind of like commenting your code.

      Of course I love Perl and believe TMTOWTDI.

    3. Re:Excpetions are a key by ftobin · · Score: 2

      Interesting. I've never run across an example of using exceptions that can't be done more cleanly, quickly, and efficiently by simply using (and checking) result codes.

      The problem with result codes is that you can't propagate the problem up to the level of scope that should be dealing with it. For example, imagine you have a GUI program. At some point, it needs to open "foo.txt", but fails. Since you're a good software engineer, you've well-separated your GUI code from logic code. The GUI needs to display an error message, but if you only check error calls, the only part that knows about the eror that has happened is way down in the logic code, which has no idea how to tell the user. And propagating 'undef's all the way up through the code is uncool. Especially since return values should not be used to indidate errors; they should be used for return values.

      With an exceptions model, you can let the logic code just propagate the error up to the GUI, who can then display a message to the user. It's a very clean, elegant system.

      try do_something except on e.excpetion do exit; end; end;

      (Sorry for the lack of prettiness; Slashdot's input mechanism doesn't allow <pre> tags.)

      This is not how you would handle it using exceptions; you would merely say "do_something". Period. If "do_something" threw an exception, and it wasn't caught, it propagates up and the program dies automatically.

    4. Re:Excpetions are a key by ftobin · · Score: 2

      Well, you haven't seen Error.pm yet. It implements exceptions for Perl.

      As I stated in my post, having high-level mechanisms for exceptions doesn't cut it. Your base operations must throw them, or else you've lost out on 50% of the reasons for having exceptions. Opening a non-existant file with open() won't raise an exception; this is a problem.

      I'm not totally convinced that exceptions are necessary for good programming

      Exceptions are not necessary for good programming, but they are necessary for good software engineering.

    5. Re:Excpetions are a key by humblecoder · · Score: 1
      Actually, there are a lot of reasons why exceptions are better than return values:


      Checking return codes often leads to messy code filed with lots of conditional statements, while handling exceptions allows you to separate your error code from the logic of your program.


      With return codes, you are forced to handle the error in the routine that called the function. With exceptions, you have the option of handling the error locally or allowing the error to propogate up the call stack to the appropriate place. Again, this helps to organize your error handling better.


      With judicious naming of your exceptions, you centralize error handling for different classes of errors in one place. With return codes, it is more difficult to do this.


      In short, exceptions allows you to better organize your error handling. On small programs, exceptions may seem like "overkill", but for large projects they yield big dividends.


      Of course, exceptions can be misused and abused just like any other language construct, but in the hands of an experienced developer, they are vastly superior to return codes.

    6. Re:Excpetions are a key by Malc · · Score: 1

      Exceptions are for exceptional circumstances. Before throwing an exception, consider whether it's really needed, or a return code will suffice... why force your client (caller) to handle a problem if it doesn't need to.

      Some people don't get exceptions... I've even seen some programmers using them instead of return values for situations that were normal and even expected.

    7. Re:Excpetions are a key by TimToady · · Score: 1

      Well then, Fatal.pm handles the other 50% of your quibble. But the "or die" idiom of Perl is nice in that it encourages the programmer to come up with a meaningful error message that is associated directly with the failing statement. An exception handler can guess about which statement threw the exception, but unless you're going to put an exception handler around every statement, it might guess wrong, and add a bogus message that would be negatively helpful.

      At the same time, the "or die" idiom pushes the exceptional code off to the right where it doesn't obscure the intent of the flow very much.

    8. Re:Excpetions are a key by KnightStalker · · Score: 2

      While this is not exactly on topic, exception-like behavior in Perl can be handled using the eval()/die()/$@ syntax.

      Certainly, exception handling in C++ or Python is much more efficient and elegant.

      Example:

      #!/usr/bin/perl
      eval{test(3)};
      if ($@) {
      print "Whoops: $@\n";
      }

      sub test {
      my $bob = shift;
      if ($bob == 1) {
      print "Happy\n";
      } else {
      die("Failure testing \$bob");
      }
      }

      --
      * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
    9. Re:Excpetions are a key by ftobin · · Score: 2

      Well then, Fatal.pm handles the other 50% of your quibble.

      No, it doesn't, because Fatal can only sanely be applied to core operations like open(), which don't deal with objects (another must for good software engineering). For example, when I write, Perl, I use IO::File to open files; Fatal doesn't help there there.

      Also, Fatal is very crude in that it just checks for false values. Perhaps a function fails if it returns undef, but succeeds if it returns a defined scalar, like 0, which tests as false! Fatal will flag this as an error, incorrectly.

      But the "or die" idiom of Perl is nice in that it encourages the programmer to come up with a meaningful error message that is associated directly with the failing statement.

      When you raise exceptions, you can associate a human-readable string with them, so you point is moot. You aren't just returning an exception; the exception is an object, which turned into a string is meant for human consumption. At least Java and Python are capable of doing this.

      At the same time, the "or die" idiom pushes the exceptional code off to the right where it doesn't obscure the intent of the flow very much.

      But with exceptions you don't even have to try to check if something failed; it automatically dies! What can be less obscuring than not being there!

    10. Re:Excpetions are a key by kaladorn · · Score: 1

      An Engineering Approach to the whole software development process is more useful than exceptions. The problem with most programming is we (programmers) tend to let something loose then see if it has problems. We don't know in advance where the failure points lie. Most proper engineering tends to know to a very high degree of confidence what can fail in a system and under what circumstances even before the system is constructed.

      The use of robust tools is key in software development, that much I will say. But I hardly think exceptions are a requirement. In what sort of sensible object model are you going to be tossing exceptions upstack anyway? Most exception handling should be done at point of occurrence for context reasons and for efficiency. If you throw exceptions up half a dozen levels, you've really taken a performance hit to do so and the code level that is addressing the exception probably has only a fragment of the context the error occured in left to work with.

      Exception generation, while interesting in concept, is useless (or problematic at least) in the real-time world. Returning with an error code is much faster and handling that error code where it occurs is usually advantageous anyway.

      If you don't care about speed, then exception handling is wonderful. I'm sure as processors continue to produce greater MIPS and BOPS counts that we will see more use of exception handling. But you can program badly with exceptions just as easily as without them. Good programming can be somewhat impeded by a lacking toolset, or by a lacking language which is inefficient or semantically poor, but it can't be totally defeated. Similarly, bad programming is not alleviated by the presence of these tools. You _can_ program well in assembler. You can program badly in Perl (God knows...) and Python.

      It all boils down to the discipline of your approach, the level of effort at rigorous error handling and disaster recovery, and the dedication and competence of your programming team. If any of these aspects is lacking, your project will suffer.

      --
      -- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
    11. Re:Excpetions are a key by ftobin · · Score: 2

      But you can program badly with exceptions just as easily as without them.

      I disagree with this. I think it is much easier to program badly without exceptions than with. Without exceptions, your code suddenly becomes a lot more ripe for corrupting data and causing security issues, without the user knowing there is a problem. With exceptions falling all the way back up the execution stack, it's immediately known there is a problem, and the program is halted there notifying the user, not causing hours more of run-time corrupting data.

    12. Re:Excpetions are a key by ftobin · · Score: 2

      You do realize, hopefully, that the die syntax makes it very hard to selectively catch exceptions. If I have a subroutine that does some array manipulations, and opens a file, I might want to only catch the IOError (file opening error) at the level I'm on, and pass the ArrayIndexError on up. eval() can't handle that well.

      CPAN has some modules that hack some exceptions, but it's all very, very unclean. Unclean and unreadable code can lead to just as many errors.

    13. Re:Excpetions are a key by zmooc · · Score: 1
      Exactly! But his other point is rather interesting, though: In fact, the programmers that I've seen use exceptions tend to be less careful than those that simply check result codes.

      This is also my expierience (Java); since exceptions are all children of the Exception object, it's rather attractive to throw all the code in one huge try-catch-clause that catches an Exception because it's `for temporarily use only'. Well and then the new version is cancelled and you're stuck with all your error handling in one place...blablabla

      --
      0x or or snor perron?!
    14. Re:Excpetions are a key by Zog · · Score: 1

      Exceptions are slow.

      In Python, last time I checked (before 2.0, at least), they were about 10 times as slow as an if statement to check the sanity of something before you use it. Not to say that exceptions are bad -- they're definitely a good way to catch stuff when you're developing something and it raises KeyError instead of dying, but it's not something that works very efficiently in a production environment, and I learned it the hard way a long time ago.

      Using if statements works extremely well in Python also because you can compare different types: say I have a function that might have an error occur and handle it, but if it is successful, it should return a tuple. I could make the function print its own error message when something goes south and return something like "error", and when it works right, just return what it normally would. And I can compare the return value to "error" if it's a tuple - and it won't mind at all. And just to use one of my data-verification schemes as an example:

      (messages and errors are arrays that store stuff so it can be printed pretty-like if they have anything in them)

      if not form.has_key('id'):
      messages.append("Missing User ID")
      errors.append("""<input type="text" name="id">""")
      else:
      id = verify_module.id(form['id'])

      if id == None:
      messages.append("Invalid User ID")
      errors.append("""<input type="text" name="id">""")

      instead of:

      try:
      id = form['id']
      except KeyError:
      ...
      else:
      if not re.match(safe_id, id):
      ...

      So there ya go :) (and just in case you're wondering, yes, I am a lunatic - I've had to write nearly 20,000 lines in the past few months on my own on a gigantic web app, and before I started keeping stuff pretty and well-organized, I was basically beating my head against a wall trying to remember why I did stuff like that)

    15. Re:Excpetions are a key by jjohn · · Score: 1

      Hash elements don't auto-vivify when used as r-values but do if used as l-values. This is a feature, honest.

      use Data::Dumper;
      %hash = (a => 0x69);
      print "b is $hash{a}->{b}\n";
      print Dumper(\%hash), "\n";

      Doesn't change the hash. But:

      $hash{a}->{b} = 0x69;

      creates a new hash with one key-value pair b => 0x69.

      Perl uses eval for exceptions. For instance:

      eval{ 0 || die "Oops" }
      if( $@ ){
      warn "Something's fugly: $!";
      }

      In perl, "try" is spelled e-v-a-l and "catch" is spelled i-f. :-)

      Checking the return status of routines is standard practice. The type of exception handling
      found in Python and Java could with a lot of overhead. I think the key word is "choice".

    16. Re:Excpetions are a key by DahGhostfacedFiddlah · · Score: 1

      Okay, I've never been a big fan, but I'm starting to be convinced that exceptions are the way to go at times. I'm just wondering for programs where speed is important - are exception calls and checks much more expensive than manual error-checking?

    17. Re:Excpetions are a key by Anonymous Coward · · Score: 0

      You know, just by reading your posts, I can pretty much guess the languages you've had experience with.

    18. Re:Excpetions are a key by mrpotato · · Score: 0
      are exception calls and checks much more expensive than manual error-checking?

      To answer your question quickly, yes, exceptions are costly and should be used with care.

      Well, they cost a lot of CPU cycles but actually they are cheaper Programmer-time-wise.

      So you decide: you optimize for short devel time and stability, or for raw cpu speed.

      --

      cheers
    19. Re:Excpetions are a key by iabervon · · Score: 2

      Exceptions are faster, assuming that they never happen. They should never happen, therefore, unless something goes wrong that occurs only rarely and involves some real problem that has to be dealt with differently. For instance, running out of disk space or getting invalid input from the user; in these cases, the user doesn't really care about efficiency as much as correctness (if I mess up, the time spent waiting for the computer to tell me what is wrong is much less than the time it would take to redo things that have gotten messed up).

      Using exceptions means that the code doesn't have to check for unusual failures in the normal case. If things are okay, it doesn't have to stop at each level and see if something went wrong; if things aren't okay, you don't care that it's slow.

      Unless, of course, you're writing Oracle stored procedures, in which case exceptions are fine in the normal case.

    20. Re:Excpetions are a key by KnightStalker · · Score: 2

      I don't see why. Just test for the exceptions you're interested in and then calling die($@) will pass your exception to the previous eval{} frame. It's really not any more unreadable than most perl code. Perl's lack of a switch() statement makes this a minor hassle of if/elses but that's really no trouble. It's less elegant than C++ but I certainly wouldn't call it "very hard".

      You can die with objects or hash/array references as well as scalars, which adds some flexibility. Furthermore, this fulfills your requirement in another comment that internal methods use the exception handling system. eval{} will catch fatal errors from perl internals.

      --
      * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
    21. Re:Excpetions are a key by vulg4r_m0nk · · Score: 1

      Perl does have exception handling. I've been using the Experimental::Exception module in a large code base ( > 100,000 lines ) with much success.

    22. Re:Excpetions are a key by NerveGas · · Score: 1

      Well, I'd almost never want it to propagate up the stack. Why not? Well, if my app can't open a file that it needs, it's awful to just let the OS give a generic, useless error to the user. I'd much rather handle things right there, and give them some useful information. But hey, that's just me.

      steve

      --
      Oh, you're not stuck, you're just unable to let go of the onion rings.
    23. Re:Excpetions are a key by radish · · Score: 2

      You only have one layer between the OS and your file handling?? Large applications will frequently have callstacks 15,20 or more levels deep. When the very bottom one goes "poof" you can either insert a load of GUI code at the very bottom (yeeeuch!), or write 15 loads of code propagating some error number up the stack (yuck!) or just use exception. Et voila, you error (together with useful error message) is automatically thrown up the stack until something says "hey I can handle that" and displays it.

      Far, far , far, far better.

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    24. Re:Excpetions are a key by jstott · · Score: 1
      Exceptions are mandatory for good programming, period. If the language you are using doesn't support exceptions (C, Perl, etc), you are going to have problems.

      That's Bull. I've used lots of exceptionally well written code from the 1960's and 1970's, a good 20 years before C++ (and C++-style exceptions) hit a critical mass. The code is in Fortran (F66 no less), a language which utterly lacks exceptions. I've personally written Perl and C code that gracefully handles any possible error. If an error occurs and you aren't aware of it, then you're not doing your job as a programmer.

      The most important prerequisit for having good robust code is to always check the return value of your library calls. malloc() returns NULL on error, time() returns -1 on error, etc. Yes, it's still possible to write buggy code, but it's impossible to write do so without assiduosly checking checking return values.

      -JS

      P.S. assert() can be a big help too. Not as graceful, I'll grant you, but an excellent tool to insure that those little "this isn't possible" results really are impossible.

      --
      Vanity of vanities, all is vanity...
  54. No just Open Source by ozbird · · Score: 2

    When you start Outlook Express, it often displays the password entry box before it has finished drawing the screen. Enter your password before the redraw has finished and Lookout locks up. (Netscape 4.7x has a similar problem, too.)

    1. Re:No just Open Source by Anonymous Coward · · Score: 0

      apparently Ozbird did not read the article. The author specifically states BOTH OSS and CSS programmers are lazy and do not add the proper error handling.

      READ THE ARTICLE PEOPLE

  55. Well... error checking sucks in most languages by TrixX · · Score: 5, Informative

    Most languages make error checking very hard. In particular, C and Perl, two of the most used langs in OSS development, lack good mechanisms for sane error checking. I might explain more, but is better explained at this document.

    btw, the document is part of a library that allows nicer error checking in C, called BetterC. (Yes, this is a plug, I've participated in the development).

    It is modelled in Eiffel's "Design by contract", a set of techniques complemented with language support to make error checking a lot easier and semiautomatic. "Design by contract" has been described as "one of the most useful non-used engineering tool".

    1. Re:Well... error checking sucks in most languages by Anonymous Coward · · Score: 0

      I would have to agree, and I would add that the problem extends from the languages up (through the tool sets/compilers, and into the software).

      Exceptions and Design By Contract are all very good, but they still are bandaids on the problem. For example, Design By Contract is not really "design" at all, it's usually more like "Run With Contract".

      Look at this: a = x / y

      The above code snippet will crash if y is 0. Now, if you are a good DBC programmer you'll check y and throw an exception before attempting the division.

      So, it seems like you've properly trapped the error, but that's not really the point. Can y in your code be 0 or can't it? That's the question, if it can then hopefully that exception will get thrown during testing and you'll find out why and fix the bug. But what if it doesn't trip until delivery? that's some serious trouble.

      And ultimately, the problem is that as a programmer we need to KNOW that y cannot be 0 in the above case, and this is where our tools and languages have let us down. That variable y came from somewhere, and though it may have undergone many operations in the course of working its way through the code it is still true that at the time the code is being written it is KNOWABLE whether y might sometime be 0.

      Of course some errors are caused by perfectly solid code just doing the wrong thing (I wanted addition, I programmed subtraction - doh!), but many more are caused by range and domain problems that could be caught at edit time.

    2. Re:Well... error checking sucks in most languages by TrixX · · Score: 2

      > Exceptions and Design By Contract are all very
      > good, but they still are bandaids on the problem

      Of course. they're just a tool, but in the end you need a good programmer. What I mean is: A good programmer gets a lot of help from DBC.

      What would be really nice is an authomatic derivation tool, so you mostly write specifications (even that doesn't solve the problem of getting the specification right). But that is too far away from current programming technology, so we must work with best bandaids possible to get some decent quality in the software (OSS or not).

      In the code example you present, I see three cases
      1) You're quite sure that y is not 0. that doesn't mean an if, it could probably be a precondition of the routine with the division. This is by far the most common case.

      2) The 0 case is possible, and must be handled. then you have 'if y=0 handle special case, else a=x/y'

      3) 0 case is invalid, but you have no guarantee that it won't happen. This usually means bad design in DBC, but in the case you must do that, you can put an exception handler

      The range/domain situation is helped by strong typing.

      In short: there are a lot of tools to help error handling. They're not perfect, but by using it we can improve software quality. Then, why not?

    3. Re:Well... error checking sucks in most languages by bowb · · Score: 1
      Exceptions and Design By Contract are all very good, but they still are bandaids on the problem. For example, Design By Contract is not really "design" at all, it's usually more like "Run With Contract".

      Look at this: a = x / y

      The above code snippet will crash if y is 0. Now, if you are a good DBC programmer you'll check y and throw an exception before attempting the division.

      So, it seems like you've properly trapped the error, but that's not really the point. Can y in your code be 0 or can't it?

      I think you are misunderstanding DBC. It's not a band aid; the whole point of it is to prevent errors in the first place. In principle at least, exceptions are never thrown in a correct DBC program (not counting exceptional circumstances that come from outside the program). The programmer can know (again, in principle) that y is not 0 because that condition would be expressed in a precondition, postcondition or invariant somewhere.

      It may not happen that way in practice of course, but it is still a useful technique. As a design tool, it forces you to make decisions where they need to be made. As a debugging tool, bugs that otherwise might never be noticed, nasty subtle ones, tend to jump out at you.

      I've never had the opportunity to write any real software in Eiffel, but I always use a "poor man's DBC" in C++ (ie. lots of assert statements, particularly for checking arguments to methods), and I've found it to be very useful indeed.

    4. Re:Well... error checking sucks in most languages by TrixX · · Score: 2

      > I've never had the opportunity to write any real
      > software in Eiffel, but I always use a "poor man's
      > DBC" in C++

      Try BetterC (see my post above). You'll probably like it if you like Eiffel exception handling and DBC

    5. Re:Well... error checking sucks in most languages by Ed+Avis · · Score: 2

      I think I should make a counter-plug for lclint (which I haven't worked on, only used), a kind of lint-on-steroids that lets you annotate your program with various kinds of assertions and have them statically checked - those most common being 'this pointer may not be null'. I haven't tried BetterC but I'll have a look. I wonder how well lclint and BetterC interoperate.

      --
      -- Ed Avis ed@membled.com
    6. Re:Well... error checking sucks in most languages by jdavidb · · Score: 1

      Of course, you knew you could do Design by contract in Perl, right?

    7. Re:Well... error checking sucks in most languages by TrixX · · Score: 2

      I have just read it... It is nice, but it implements only half of the functionality: Definition of axioms over the abstract type (pre/post conditions and invariants), and checking of that assertions.

      But it lacks the exception mechanism that makes that checking useful for writing robust program. It is a tool just for correctness, and DBC works toward correctness and robustness.

    8. Re:Well... error checking sucks in most languages by avdi · · Score: 1

      I took a look at your page, and what you described were all common techniques used in C++ coding. Instead of BetterC, why not just recommend people code in C++, after first reading a little Stroustrup, Meyers, and Meyer to learn how to do it _right_?

      For example, in your memory allocation examples: that's what std::auto_ptr is for. Use auto_ptrs to point to your memory; if something fails, and you wind up throwing an exception, any allocated memory will automaticly be freed as the stack unwinds. Better yet, encapsulate *all* resource allocation inside classes, and make sure their destructors take care of freeing allocated resources. Shazam, resources will always be freed up when you a) exit the enclosing scope, or b) throw an exception.

      Pre- and postconditions, as well as invarients, are equally easy to implement in C++. So my question is, if you have an aversion to coding in Eiffel, why not just use C++ instead of reinventing it?

      --

      --
      CPAN rules. - Guido van Rossum
    9. Re:Well... error checking sucks in most languages by TrixX · · Score: 2

      It's not my page. I have contributed to the project, and done some documentation translation but I am not the author.

      What you recommend works just for a particular case: resource allocation/deallocation. pre/post condition+invariants, combined with a proper exception handling mechanism, allow handling this and every error handling case I've met.

      I have aversion to C++, not Eiffel ;) But people (boss/professor/etc.) sometimes forces you to work in C/C++ so you need something like BetterC (or that provides similar capabilities) to do proper error-checking without throwing up and making your code a mess. (btw, BetterC works nicely with C++ too).

      Check this thread I started here, and see what people usually does. At the end I posted a DBC solution that is simple, clean, and check a lots more than most people did WITHOUT doing almost anything special.

      It is true that pre/post conditions can be implemented in C++. But it's hard to get the precise semantics, like:
      * Invariant checks should be made only on calls external to the object, but not internal ones. They must be made on entry or exit
      * pre/post must not be checked on function calls inside other pre/post checks.
      * a precondition violation must raise an exception in the caller routine, not in the called one.

      And several other things. That's why I advocate the use of a library or language facility that allows doing that with proper semantic. That's is not exclusive with standard error handling techniques like auto_ptr, which help a lot too.

      If we want good error checking, it's necessary to provide programmers with tools that allow them to do error checking without shooting themselves in the foot

    10. Re:Well... error checking sucks in most languages by Anonymous Coward · · Score: 0

      >>It's not a band aid; the whole point of it is to prevent errors in the first place.>>

      But that is my point. DBC doesn't prevent errors, it only catches them. And it only catches them if you happen to trip the error in runtime. So, only those errors you "hit" are prevented.

      The error of x/y where y is 0 could be "caught" at edit or compile time if the language were siginificantly expressive and the tools robust.

      Don't get me wrong, I'm a huge advocate of DBC - its the best thing we've got right now. I've read Bertrand Meyer's books backwards and forwards. But I say again, that DBC isn't enough. More error prevention is possible with a better language (not Eiffel) and better tools.

      Preconditions, postconditions, and class invariants COULD be beefed up and validated at compile time, not merely tripped at run time.

    11. Re:Well... error checking sucks in most languages by jdavidb · · Score: 1

      There are also several Exception and Error classes you might be interested in.

    12. Re:Well... error checking sucks in most languages by SW6 · · Score: 1

      Most languages make error checking very hard. In particular, C and Perl, two of the most used langs in OSS development, lack good mechanisms for sane error checking.

      Although you wouldn't believe it from looking at the average Perl script (given the kind of weenies that think that because they've read the Llama, they know everything about Perl), Perl does actually have exception handling which works in a similar fasion to C++ and Java:

      eval { # try block
      open FOO, $file
      or die "Can't open $file: $!"; # a throw
      };
      if($@) { # catch block
      do_stuff();
      }

      If you prefer the names try, throw and catch rather than eval, die and $@, then there's modules on CPAN that can fake the more traditional syntax for you.

  56. There a no such things as errors! by toupsie · · Score: 3, Funny

    The open source community should take the same stance as closed source corporations when it comes to bugs. They are not really bugs but undocumented features!

    --
    Strange women lying in ponds distributing swords is no basis for a system of government.
    1. Re:There a no such things as errors! by Anonymous Coward · · Score: 0

      Umm, but with open source, they _are_ documented. Right there in the source code.

  57. Academia encourages bad habits by paulydavis · · Score: 1

    One of the problems is that when people learn to code in college they are not encouraged to do error checking. I can understand why this is so. I once turned in a simple program that was on average a page to a page and a half of code (c++). I went back later to have some kind of mechanism (this was before I knew about try Ccatch circa 1995) that would catch people from inputting the wrong type and locking things up because of the error flag being set (if they did I re-set the bit and had them input again). Plus other things like other runtime errors and the like (divide by zero errors were always required to be checked). This took as much time as writing the original assignment and almost added a page of code (maybe a half page J ). The point is it wasnt required. Just the other day, (Im A Grad student now) I over heard a student tell a TA But the professor said we dont have to check if the input is valid he said assume it is.± Colleges and universities have gotten a lot better about documentation and the like, but much improvement needs to be done in getting people to catch runtime errors in their programs (especially c, c++, and java but java in some ways forces it upon you). The problem is the time factor that is involved. Im not sure I have the answer to that. Except I know that when you learn bad habits they tend to stay with you. It took me personally a long time to learn to document BEFORE (design) and during coding, but through discipline I changed my ways. If Professors forced people from the start to do such things(as in error checking) then when the projects got bigger maybe it wouldnt be so bad. And in so doing maybe it would filter into real world projects that people always consider error checking.

    Then again maybe not.

    1. Re:Academia encourages bad habits by Nikau · · Score: 1
      Not every post-secondary institution operates like this. At the college I attend for CS, anywhere after the first level (where you don't really do serious programming) you have to perform error checking, to some degree or another. If you don't, you can lose a few marks or in some cases, all of them.

      As you stated in your comment, there are occasions I've had where the professor has said "I won't try this", too, but there are others he will check.

      As such I've gotten used to building in error checking. It's become a near compulsion... Did I forget to check for divide by zero? Improper menu selection? Null pointers?

      The programs we're writing aren't major applications. The last semester I took, we created a compiler in one course, a simple database in another, and some client-server apps. For these error checking is definitely necessary!

      I guess the point I'm trying to make is that not every place is the same. I'm fortunate enough to be attending a good school for CS where they do their best to encourage good coding habits, and I think that'll prepare me well for serious coding later on.

      --
      There is no escape from The Muffin.
  58. Re:That all depends on... (slightly OT) by FastT · · Score: 3, Insightful
    Why does it seem like there are as many people in the "community" criticizing open source as there are supporting it?
    Because the reality is that open source software is neither as good as, nor as bad as, the zealots on both sides claim. More than closed source development, open source development is subject to significant variability in the skills of its practitioners. There is some open source software out there that is complete crap, and some that is very good, and far more than either that is merely mediocre.

    And I would be careful about holding up Tomcat as an (open source) triumph. It's had some major bugs all through the 3.x timeframe, and its team includes at least a few daytime profressional "closed source" programmers (there's no correlation between the two, by the way).

    --

    The only certainty is entropy.
  59. Code Review by timmartin · · Score: 1

    I believe the number of error can be reduced with code reviews. This site can help you get reviews :)

    1. Re:Code Review by DrSpin · · Score: 1

      I believe the number of man years the project takes can be increased by code inspections, but having sat through a few, I am less convinced that errors will be reduced.

      As others have said already, bad programmers prouce ad code. Goodd programmers cost money. Unemployed programmers produce freeware/open source.

      Programmers who produce really dismal code are probably unemployable, but there is no law against them shipping freeware/open source.

      I have just wasted three hours trying to install some commercial software over a network that was so defective I gave up. So you pays your money and takes your choice, but I'd rather have free crap than pay good money for shite.

    2. Re:Code Review by bluGill · · Score: 2

      I disagree. Code reviews do an excellent job of catching errors. However you need a code review as soon as it compiles. Code reviews will catch those bugs that you spend the first couple weeks getting rid of. [if (x=y) instead of if (x==y), and some logic errors if(Error) { normal case} else { error case}]

      I just commited a piece of code that cannot be checked any other way. Code that checks for hardware errors, but the hardware modifications to reproduce it are not worth the cost, after I was done codeing. Code reviews are my only chance of getting the code to work right.

  60. Error handling is a usability concept by The+Swedish+Chef · · Score: 1

    In my experience, applications with a big focus on usability tend to have better error handling on multiple levels, the first being more of it; the second being better explainations of errors that do occur.

    Given that most open-source software doesn't have a big focus on usability, I think it's obvious that open-source applications will be perceived as having poor error handling.

  61. I think the real difference by anti-drew · · Score: 1

    ...is that open-source software tends to ship with error messages turned on. Closed-source software often generates no fewer errors, but it tends to ship with error messages compiled out.

    I would venture to say that a mature open-source project probably has better error handling than a corresponding mature closed-source project, simply because in the closed-source projects I've worked on have always had tight schedules and we've rarely had time to go back and clean up all those last bugs, no matter how major. It was "good enough" and it shipped, time to move on.

    OSS developers can do that, and I think it generally leads to better software in the long run.

  62. My plan by jo2y · · Score: 1

    I'm starting an OSS project and I decided as one of the first things I would do would be to check the return value/status of every function call, and any of the functions that I wrote would use the return value as an error indicator.

    I also wanted to assign each instance that an error, fatal or not, a unique error number that could be looked up on a website. One the website would have a description of what was happening that might have caused that error, and some suggestions to try. Perhaps I could add a place where users could submit comments to that.

    I'm told that is similar to what Oracle does? I think realplayer does something similar, except when I click the link for more information 100% of the time I get a webpage that says "This error doesn't happen that often so we don't have anything to say about it" which I take to mean, "We don't know what the hell happened either"

    Have any readers tried anything like this that has worked?

    1. Re:My plan by PurpleFloyd · · Score: 1

      Why have error numbers alone? Why not include a terse description of the error ("Could not open file x. Please try again) instead? I would imagine that this would also save time compared to writing the error database.

      --

      That's it. I'm no longer part of Team Sanity.
    2. Re:My plan by sqlrob · · Score: 1

      So you have English descriptions. Then someone in France gets the error..

      A database or lookup files are a hell of a lot easier to internationalize

    3. Re:My plan by jo2y · · Score: 1

      You slightly miss my point. :)

      I want an identifier that is unique, so that you could look up that identifier and get a paragraph or two explaining what might have gone wrong.

      I once got an error message from the kernel after I unmounted a drive that said something like. "Lost some inodes, things will now self destruct" I think it turned out to be not as critical as it sounded, but if it said "kernel-23456 Lost some inodes, things will now self destruct" Then I could easily search for kernel-23456, or if there was a website dedicated for documenting things like this, it would make the end-user experience easier.

  63. Them thar's fightin' words by fobbman · · Score: 2

    Yeah? My code might not handle errors well but your server doesn't handle a load well and at least my code will never get /.'ed.

  64. This ones easy. by MongooseCN · · Score: 2

    Check your return values!! As simple as it sounds, so many people just don't do this. Everyone just assumes that everything will go ok. Check the return, then print out an error to stderr. To be more helpful use this define just before you print your error message to help find where the error was and debug it.
    #define ERR_LOCATION fprintf(stderr, "ERROR in File: %c Line: %d :", __FILE__, __LINE__)

    Then use it like so:
    ERR_LOCATION;
    fprintf(stderr, "foo returned %d.\n", ret);

    I believe that's the correct code.

    1. Re:This ones easy. by PigleT · · Score: 2

      The difference, speaking from personal experience of one datapoint, is that the `commercial' world employs monkeys who say "oh yeah, On Linux gethostbyaddr_r returns -2 in this case" whereas in the free world, in the next release, libc6 (note, not "Linux") will return a different code, and in the real world, people will not be so stupid as to hard-code the numbers by hand when there are perfectly good symbolic Esomething constants to be used instead.

      --
      ~Tim
      --
      .|` Clouds cross the black moonlight,
      Rushing on down to the circle of the turn
    2. Re:This ones easy. by mmontour · · Score: 2

      It's even easier than that - just use the built-in "assert()" macro. This is a good thing to wrap around any function call that "can't ever fail", just so that when it does fail, your program will terminate cleanly and tell you the location of the error.

      (Insert standard Douglas Adams quote about things that can't ever go wrong)

    3. Re:This ones easy. by Malc · · Score: 2

      Ahhh... assert: the basis of all good pre- and post- conditions, and any sanity checks you need in between ;)

    4. Re:This ones easy. by mOdQuArK! · · Score: 1

      Ummmm...I wouldn't wrap it around _any_ function call, since when you compile with the NDEBUG flag (usually in conjuction with the -O optimization flag), anything inside the assert() gets turned into a null statement.

      More accurately, you commonly use the built-in assert() macro to check the values of variables which were used to save the return values from functions. And you've got to make sure that evaluating those expressions don't cause any side effects, otherwise you're setting yourself up for some hair-ripping debugging.

    5. Re:This ones easy. by mmontour · · Score: 2

      Good point. I stand corrected.

      I don't normally use the "NDEBUG" flag, and when I looked at the man page I guess I assumed that "assert(x)" would become "x" instead of "" when NDEBUG was on. However I just tested it, and it does indeed throw away the whole statement. Not the way I'd do it, but I guess the standards committee had their reasons (or were all in a hurry to take off for a long weekend...).

    6. Re:This ones easy. by Anonymous Coward · · Score: 0

      How about just having a way of saying
      "From now on if anything other than function ABC fails, raise an exception".

      Rather then throw exceptions explicitly, why not have a language that _can_ throw them automatically. By _can_ I mean it's optional, you don't have to always use it, and it can be used in just certain parts. Otherwise few people would be able to get better at using the language.

    7. Re:This ones easy. by reflective+recursion · · Score: 1

      It's not quite as black and white as that, though. Once you start abstracting from the standard C library, or what have you, simple returns mean less as you go higher in abstraction. Sometimes we want to give the user options when an error occurs. This is what makes a user interface a _good_ user interface. How do you retain all that information on exactly what failed and where? Beyond the simple printf(), it becomes tedious at best and damn near impossible at other times.

      --
      Dijkstra Considered Dead
    8. Re:This ones easy. by J.+Random+Software · · Score: 1
      Would you wear a life jacket in the wading pool but discard it to go out to sea? Maybe you could make a case for profiling to find the biggest few bottlenecks, test them exhaustively, and then wrap the assertions in
      #if SPEED_OVER_SAFETY
      but globally ignoring all of them (letting phases such as initialization quietly fail) is deranged.
    9. Re:This ones easy. by mOdQuArK! · · Score: 1

      Can't quite tell what you're getting at here - are you critical of the way that the assert() macro works, or are you approving its behavior?

    10. Re:This ones easy. by J.+Random+Software · · Score: 1

      IMHO assert() is showing its age. It ought to throw an exception (and the runtime should provide a stack-trace facility with module names and line numbers for exceptions that aren't specially handled; Java does a good job here), and should be selectively disabled or not at all. Disabling them all is almost always the Wrong Thing.

    11. Re:This ones easy. by mOdQuArK! · · Score: 1

      I guess it depends on what you think assert() should be used for. My understanding of assert(), is that it is only intended for non-side-effect debug checking - in essence, making sure that things which are supposed to be true (or false) actually are. assert() is not intended to be used for anything which might change stored values or the control flow of the process.

      In other words, if you are using assert() for such things, then you are using it incorrectly.

  65. should be better... by Anonymous Coward · · Score: 0

    open source programmers suck at error handling? damn... i could have told you that. i suck at it. i hate it. error handling is a pain... especially when a C function can return five or six different errors. it's so much easier to just assume that there's four of those that will never occur.

    that isn't to say we shouldn't do better... but open source projects don't tend to get error handling really done until the project has picked up a lot of users and developers. the kernel kicks ass at error handling... so does X11.

  66. There is a significant difference by Anonymous Coward · · Score: 0

    And which makes more sense to your average Joe using the application?

    If you want to be friendly to your users, changing a couple of trivial words actually isn't a waste of time.

    "Performed an illegal operation" makes sense to most people - it did something not allowed

    "Seg fault. Core dump" means nothing unless you know how to "fault a segmentation" and what a core file is.

    Of course if you can actually attempt to explain what went wrong, then that's better again... Otherwise just make it meaningful to the lowest common demoninator you would like to use the app/os.

    1. Re:There is a significant difference by Anonymous Coward · · Score: 0

      "illegal"... are they coming to my house?!?

    2. Re:There is a significant difference by Anonymous Coward · · Score: 0

      When my parents see "illegal operation" messages, they tell me, in a frustrated or concerned tone, that they weren't trying to do anything illegal, so why did the program acuse them of that and then shutdown. I've tried to explain, but the knowledge seems to expire.

      It's a dual boot machine, and they know how to log into their accounts through KDM and do whatever they want there. And they get there share of linux problems. The main two being (1) occasional seg faults, which they simply see as the program crashing, and (2) run-away processes that consume resources to no end, until the system crawls, at which point they just power down the machine.

      This has, on more than one occasion, resulted
      in corrupted partitions, followed by reinstalls...
      (I've had it happen on ext2, and reiserfs. I've got ext3 now, we'll see how that goes)

      And suddenly the "illegal operation" messages don't seem so bad.

    3. Re:There is a significant difference by crucini · · Score: 2
      (2) run-away processes that consume resources to no end, until the system crawls...

      You could set up a process monitor script that either runs as a daemon or via cron. If the same process is using 80% CPU or 80% memory two samples in a row, it would kill the process and pop an xmessage saying "$program was using too much memory, so I killed it."
  67. Commercial software does it differently by Philbert+Desenex · · Score: 2

    I don't think that a straight comparison of open source to commercial software, in the context of error handling, has any merit.

    I'll try to illustrate with an example. I'm running IE 5.00.2920.00 on Windows 2000. I get a huge number of "Cannot find server or DNS error" pages from IE. You know, those are the stock HTML files that IE displays that say "The page cannot be displayed", and it has a whole boatload of gibberish on it about clicking the Refresh button, contacting your network administrator, checking URL spelling, etc etc etc.

    Unless the host machine is truly unreachable, I can click "Refresh" and get the appropriate page almost instantly about 80% of the time. Does that make you smell a fish? It makes me smell a fish.

    The fish that I smell is commercial software handling errors in such a way as to blame anything other than itself when it encourters an error. I'm sure this works on most Windows users, because they've never used anything else, and their desktops crash all the time. Why shouldn't web sites just arbitrarily refuse to give up a page now and then? But if I'm debugging a web server that I'm telnetted to from my SPARCStation, and IE on Win2K claims that the web server can't be found 12% of the time, yet finds it instantly on refresh, I begin to see a pattern.

    If you write commercial software, the pattern is to including fairly complete error handling, but make the error handling blame something else. IE didn't choke, DNS or the remote server did, or you typed the URL wrong. Anything but admit that IE had the problem.

    Open source programmers don't experience pressure from marketeers and PR people and "product managers" to appear blameless. Open source programs tell it like it is, up to the limits of the programmer's articulation. That's why it's useless trying to compare the two: commercial software handles errors in order to shift the blame. Open source software handles errors in order to provide debugging information.

    1. Re:Commercial software does it differently by zulux · · Score: 2

      There is a well documented case of how the Microsoft's BSOD changed from pointing out that "Windows Has Become Unstable" to "msdcex.dll has caused a fault" between Windows 95 and Windows 98. The change was done as to make it appear that Windows was not to blame.

      --

      Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

    2. Re:Commercial software does it differently by spectecjr · · Score: 1

      Unless the host machine is truly unreachable, I can click "Refresh" and get the appropriate page almost instantly about 80% of the time. Does that make you smell a fish? It makes me smell a fish.

      No, it doesn't sound fishy to me at all.

      The first time you tried to access the file, it could have been one server out of many load-balanced server. That server could be down.

      Eg. go to Microsoft.com, and do a gethostbyname on it. It'll return about 6 different host IPs. IE will pick one of these at random. If it fails, you'll see an error. Hit refresh, and a different one is accessed.

      Also, with high-load, some servers just kill your connection with a 404 error -- or just do a reset and drop you.

      Simon

      --
      Coming soon - pyrogyra
    3. Re:Commercial software does it differently by MrBogus · · Score: 1

      In addition to the load-balanced server explaination, I occassionally hit a IE (4/5/6) bug where it gets confused and thinks it's in "offline" mode.

      You immedately get the 404 page, but when you press reload, it goes 'online' and finds the page. Something to do with going to localhost pages -- haven't quite figured it out yet.

      --

      When I hear the word 'innovation', I reach for my pistol.
    4. Re:Commercial software does it differently by Anonymous Coward · · Score: 0

      He said he was testing his own server. Somehow, I doubt load-balancing is the issue there.

      I've had the same problem with IE on various systems. It seems to occur more on lower-end systems than higher-end ones, but it's definitely not limited to Win2k.

    5. Re:Commercial software does it differently by Anonymous Coward · · Score: 0

      My guess is that this is caused less by a commercial push to blame someone else, and more by the natural tendencies or programmers. When a call to some library fails, programmers often don't immediately blame themselves. After all, that line of code has been executed thousands of times under many different scenarios, and has worked fine each time. The programmer will probably report the error, but will blame it on some external cause -- out of memory, DNS error, or the like. Claiming that open-source is somehow different here is just plain silly.

      On the other hand, I've read enough commercial code to know that it's often no better at error handling than open-source code. Some companies (and, more specifically, some groups inside some companies) are very good about always checking for error conditions. However, to often you see commercial code that doesn't check at all. This problem is more visible in the open-source community, because of the very nature of open source; however, it plagues commercial software just as well.

      Reuven

    6. Re:Commercial software does it differently by J.+Random+Software · · Score: 1
      True. Or as Neal Stephenson put it,
      Commercial OSes have to adopt the same official stance towards errors as Communist countries had towards poverty. For doctrinal reasons it was not possible to admit that poverty was a serious problem in Communist countries, because the whole point of Communism was to eradicate poverty. Likewise, commercial OS companies like Apple and Microsoft can't go around admitting that their software has bugs and that it crashes all the time, any more than Disney can issue press releases stating that Mickey Mouse is an actor in a suit.
    7. Re:Commercial software does it differently by Anonymous Coward · · Score: 0

      "There is a well documented case of how the Microsoft's BSOD changed from pointing out that "Windows Has Become Unstable" to "msdcex.dll has caused a fault" between Windows 95 and Windows 98. The change was done as to make it appear that Windows was not to blame."

      And in this case, I agree with them. That DLL could just as well have been a flakey 3rd party device driver, in which case the fault isn't Windows. The new msg tells what part of the OS caused the error, and if it's a Windows DLL that will be apparent (or quickly pointed out on newsgroups).

    8. Re:Commercial software does it differently by zulux · · Score: 2

      And in this case, I agree with them. That DLL could just as well have been a flakey 3rd party device driver, in which case the fault isn't Windows. The new msg tells what part of the OS caused the error, and if it's a Windows DLL that will be apparent (or quickly pointed out on newsgroups).

      It's still the fault of Windows - a decive driver should not be able to bing down the kernel of an operating system. Failure of a decive driver is ok and to be expected, but to have that failure cascade down to ring zero is unacceptable.

      --

      Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

  68. Amateurs by Anonymous Coward · · Score: 0

    Poor error handling is due to poorly trained programmers (of which there are too many), it is not a function of the language.

  69. Blanket statements by Wonko42 · · Score: 3, Funny
    "Intelligent people don't make blanket statements..."

    Wait for it...wait for it...ahhhhh!

  70. Almost all programmers Stink At Error Handling by matsh · · Score: 1

    Maybe one out of 10 does it well.

  71. Re:That all depends on... (slightly OT) by noahbagels · · Score: 1

    Hey - I don't need any mod+ on this, but have to agree with you. Tomcat isn't a triumph, which is why I added the caveat that I was only referring to it's error-log implementation and configuration.

    Apache is definitely a triumph.

  72. This isn't really about error handling. by Nindalf · · Score: 2

    This is about detected bugs which haven't been fixed yet.

    Basically, his complaints boil down to, "bugs exist, causing error messages, why aren't all the ones that cause error messages fixed yet?"

    Then he goes off on a confused tangent, apparently suggesting that "error handling" be added to work around any bugs. After all, if it can log the errors caused by bugs, it can respond to them in any way, up to and including fixing the problem (i.e. doing what the code should have done, except for the bug)! For example, if a system file is missing (meaning either a bug in the install, a bug in the program requesting something that isn't really a required system file, or an externally damaged system that can't be expected to work at all), just pop up a dialog to let the user search for it! Because of course the user should attempt to patch things up with his intimate knowledge of system internals instead of just seeing that there's a bug to report.

    Hooooo boy....

    I didn't see a single example of a genuine external error that wasn't handled properly, just bugs which should be fixed.

  73. Re:That all depends on... your selection of course by noahbagels · · Score: 1

    Uh - I don't know where you're getting this.

    "Completely theoretical" ?????

    Please - raise your hands if you've ever actually developed anything beyond asp for IIS?

    It crashes left and right, with no memory protection for in process DLLs or custom proxy-plug-ins.

    I don't care about the mod for this, but IIS is a piece of crap, with poor logging and it's easy to crash.

  74. Looks OK to me. by WasterDave · · Score: 2

    He chose some pretty bad examples of bad error handling - they all gave the module and direct cause of the error, and provided ample clues for the programmer in each case to go find out what went wrong. If we're looking for anything that open source programmers do that stinks, it's making GUI apps that pretend nothing's wrong.

    Way to go, I say. Would rather have hugely detailed warnings any day.

    Dave

    --
    I write a blog now, you should be afraid.
    1. Re:Looks OK to me. by Enigma2175 · · Score: 2
      He chose some pretty bad examples of bad error handling

      In addition, most of the examples he gave were not programs crashing. I think the problem is open-source software generally is more verbose in error checking. Proprietary software generally gives you NO ERROR MESSAGES, it just crashes indiscriminately. At least OSS programs give me an explanation of what might have happened, and often directions on how to fix the problem. Windows, for example, has given me error messages like: "An unknown error has occured in <unknown application&gt. The program will be terminated." I never get error messages like this in Linux. The error messages being verbose doesn't mean it is bad software, it means it is good software.

      --

      Enigma

  75. Three true things by WillSeattle · · Score: 0, Troll

    1. Most open source developers are lousy at writing good error handling.

    2. Most closed source developers write error handling routines that pass the blame to someone else's code or are not helpful.

    3. Open source means you can fix the code. So stop complaining and do something useful.

    --
    --- Will in Seattle - What are you doing to fight the War?
    1. Re:Three true things by The+Bungi · · Score: 1


      3. Open source means you can fix the code. So stop complaining and do something useful.

      That's the spirit the corporate world just loves so much. Props to all h^x0rz.

    2. Re:Three true things by Guy+Harris · · Score: 2
      3. Open source means you can fix the code. So stop complaining and do something useful.

      I presume that's either a troll or a parody of the sort of nonsense that all too often gets put out in response to complaints. If it isn't, I'll simply note that you probably can't fix the code if you are not a programmer, which a lot of users aren't.

      (On the other hand, users of open-source software should bear in mind that the developers are often not working full-time on the program - they may have day jobs, or may be going to school, etc. - and therefore that the feature that they really really really want may not have been implemented yet because nobody's had time to implement it, so they may Just Have To Wait.)

    3. Re:Three true things by WillSeattle · · Score: 1

      3. Open source means you can fix the code. So stop complaining and do something useful.

      I presume that's either a troll or a parody of the sort of nonsense that all too often gets put out in response to complaints. If it isn't, I'll simply note that you probably can't fix the code if you are not a programmer, which a lot of users aren't

      Nope, it's a comment. The point is that 1 and 2 may be true, but the whole point of open source is that one can fix the code. This does not mean that you have to, but it means that you can.

      If error handling is done incorrectly, rewrite it and submit it back as a changemod.

      We are so used to the closed source model, where the originating software company has to find the bug and fix it, that we fail to understand the whole point of open source is that you get the code. So you can fix it.

      In closed source, you have no choice. You must let them fix it.

      In open source, you have a choice. You can tell them it's a bug and let them fix it. You can find the problem segment of the code, point out where it should be rewritten, give a sample, and let them fix it. Or you can fix it yourself, clean your own version, and send it back as a changemod.

      You have the power. If it really bugs you that much, fix it.

      It's like a car. If you have tools, you can fix it when it breaks down. You can open the hood. If it's closed source, the hood is welded shut. Admittedly, if it's not something simple, you probably let them fix it (take it to a shop) or sell it as a lemon. But a lot of times it's something simple.

      And thanks for modding me down as a troll, just because I point out that you have more responsibility as a user of open source than you would as a user of closed source. You can shirk your duty, but it's still there. If you can fix it, do so. If you can't, submit the bug. But whining and doing nothing are not acceptable.

      --
      --- Will in Seattle - What are you doing to fight the War?
    4. Re:Three true things by Guy+Harris · · Score: 2
      The point is that 1 and 2 may be true, but the whole point of open source is that one can fix the code. This does not mean that you have to, but it means that you can.

      You can if you are a programmer, and familiar with the language in which the program is written, and familiar with the theory behind the program (if any).

      If you can fix it, do so. If you can't, submit the bug. But whining and doing nothing are not acceptable.

      If "submit the bug" means "report the problem to the developers" (they may not have a formal bug-tracking system; perhaps they should, but that doesn't mean they necessarily will), then, yes, one should do that, regardless of whether the software is open-source. If the developers don't know about it, they aren't likely to it, except by accident.

      However, all too often the "fix it yourself, or submit a bug" response to complaints gets over-simplified to "fix it yourself, you have the source", which is an error - there may be users who don't have the knowledge to fix the problem themselves. If that's what you really meant, that's what you should have said, clarifying "do something useful", which, in your previous message, was preceded by "Open source means you can fix the code", a statement, that, as noted, is not necessarily true unless you use a rather unrealistic definition of "can" (e.g., "can, if you learn a programming language and spend a lot of time studying the code and the theory behind it first").

      And if your posting was responding to Petreley's article, accusing him of "whining and doing nothing", note that he wasn't just complaining about specific problems (which he should report to the GNOME, KDE, etc. developers), he was complaining about an apparent general attitude, and "filing bugs" on that may mean filing bugs on projects that don't even exist yet, so that when people write some new project they take more care handling errors, including those that "can't happen".

  76. Error messages need to be have error numbers by Khalid · · Score: 3, Interesting

    Error messages need to have numbers associated with them. For instance when I have ORA-1241 in oracle, a quick search in groups.google.com will give me a lot of informations about this error, and why it occured and what I can do about. Alas, there is no such thing in most of Open Source software, you just have plain text, so the search is less effective, which search keywords are you going to choose. The situation is even worse for people who used localised versions of the software, as you don't have the English transltation so you can search the English archive in groups.google.com and which count for 80% of the posts.

    What might be cool is a codified error numbering a la Oracle for instance. I would love to have KDE-2345 error, or GNOME-1234 error, or Koffice-567 etc. That would made searchs far more effectives

    1. Re:Error messages need to be have error numbers by nemesisj · · Score: 1

      I'm all for error messages that have codes like you described above, as long as the code is accompanied by a human readable (and hopefully understandable error) such as:

      ERROR KDE-2345: You forgot to install something this application needs.

      I think that is the best of both worlds, and please, no "Contact your system provider" errors.

    2. Re:Error messages need to be have error numbers by Anonymous Coward · · Score: 0

      Yeah there's nothing better than having an obscure and meaningless error number to look up. What innovation!

    3. Re:Error messages need to be have error numbers by Procrasti · · Score: 1

      Better still is Java's error handling. I plug Java a lot, because it's what I use now and there are Open Source versions of Java such as Kaffe - its not the only language on the planet (but it should be :) ).

      Anyway, throw an exception in Java, it should have a name that makes sense, eg NullPointerException. Then you also get access to a stack trace that can be logged. If you have JIT turned off, you get line numbers as well as the usual class and method names. Really nice for working out what went wrong. With a well designed app and exception handling, your program can carry on, after dealing with the exception, and provide a very useful log for improving the source code.

      Someone should fork Kaffe and continue work on it, or produce an OS JVM written in Java, like IBM's Jallapeno Java RVM.

  77. Tribes 2 by red_one · · Score: 1

    What about the windows version of Tribes 2? (loki did the linux port ,and it's rock solid)

    "Unhandled Exception at " Is the buzzword of the day.

    Perhaps on average open-source software is buggier (due to programmers with larger 'maverick' streaks), but there is still some shocking commercial stuff out there.

    1. Re:Tribes 2 by itarget · · Score: 1

      I don't know what's worse... The fact that Tribes2 suffers unhandled exceptions so often, or the fact that they always seem to happen in the forums, of all places.

      I get a UE maybe once every few days in the complex gaming environment with vehicles screaming by and weapons fire all around... but in something as simple as the forums, I can't go more than 20 minutes before the all-too-familiar UE dialog shows up.

      --

      "Where shall the word be found, where will the word resound? Not here, there is not enough silence." -T.S. Eliot
  78. from linux/drivers/char/lp.c by BubbaFett · · Score: 1

    A classic example of horrible error handling:

    } else if (!(status & LP_PERRORP)) {
    if (last != LP_PERRORP) {
    last = LP_PERRORP;
    printk(KERN_INFO "lp%d on fire\n", minor);
    }
    error = -EIO;

  79. Tell me this isn't ironic by Fun+In+The+Sun · · Score: 1
    I tried to view the page and here's what I got...


    502 Proxy Error

    Proxy Error

    The proxy server received an invalid response from an upstream server.

    The proxy server could not handle the request GET /site-stories/2001/1025.errorhandling.html.

    Reason: Could not connect to remote machine: Connection refused

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Tell me that's not irony right there.
  80. You asked for it by Anonymous Coward · · Score: 0

    The answer is yes - commercial software handles lots of things better - they're paid to put out a good product. Sometimes deadlines get in the way, yes, but hey is that Mozilla finished yet? That's what I thought

  81. Ironic by Anonymous Coward · · Score: 0

    Proxy Error
    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET /site-stories/2001/1025.errorhandling.html.

    Reason: Could not connect to remote machine: Connection refused

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  82. Maybe people expect too much from software. by Carnage4Life · · Score: 5, Insightful
    One of my friends counters arguments about software being too sloppy with the point that there is practically no other field where a product is designed to be used on such a varying degree of ways and expected to still be robust. For instance, let's use a car as an analogy to your complaints

    The key CD is now scratched which hangs the authenticator forced a quite ungraceful reboot and corrupted my hard drive. (Perhaps a $150 upgrade will help. I'll never know.)

    how is a programmer expected to deal with the CD being scratched? Does your car still work if the transmission is damaged or half the engine has been riddled with bullet holes?

    The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file. (I will not use it again.)


    Again, a very unexpected and unnatural scenario. How well do cars function when they run out of fuel?

    The most amazing part is that this state of affairs doesn't surprise me. If my refrigerator intermittently defrosted and melted icecream all over the kitchen I'd be ticked. If my car mysteriously dies at stop signs I get it fixed.


    But how well would your refrigerator react if you treated it shoddily such as by leaving it outdoors intermuitently or diconnecting and reconnecting the power several times a day?

    Now, I'm not trying to excuse sloppy software development but the fact of the matter is that software is constantly expected to work perfectly under situations completely outside its specifications yet we don't expect this from other items or appliances that we use.
    1. Re:Maybe people expect too much from software. by Xerithane · · Score: 2

      You hit it straight on the head - I wish I had mod points because you would definitely go up there. I was about to post in response to that guy saying mostly the same things you said, except much less well-spoken.

      Programmers are people, people make mistakes. Users are people, people make mistakes. Most often I've found problems arising from stable software coming from people using the software in a way it shouldn't be used.Using a full disk and complaining because it saved a mangled version of your original is just assinine. You are saving OVER a file. It is just extra code and bloat to ensure that your drive still has enough space every time you do a file save operation. I could understand being upset if he was doing a Save As operation.. but get real, it's his fault - not the software.

      This mid-afternoon rant session has been brought to you by a slow day of engineering as my current project nears delivery.

      --
      Dacels Jewelers can't be trusted.
    2. Re:Maybe people expect too much from software. by innocent_white_lamb · · Score: 1

      software is constantly expected to work perfectly under situations completely outside its specifications yet we don't expect this from other items or appliances that we use.

      If only that were the case. Unfortunately, the situation is such that in many cases software that is being used exactly as intended blows up.

      How many people would keep using a typewriter where the keys jammed twice each morning before coffee break? They would soon send it in for service! Yet those same people just quietly reboot their computers when win/word crashes and they don't think anything of it.

      After all, how many ways are there to type a letter and print an envelope to put it into? And how many times does a crash occur when someone's secretary is doing just that (and nothing else).

      If it was only "exceptional circumstances" that led to crashes, then this whole thing would be less of a problem. Unfortunately, it's not "exceptional", though, just normal everyday actions and BLAMMO! Where's the reset button?

      --
      If you're a zombie and you know it, bite your friend!
    3. Re:Maybe people expect too much from software. by The+Panther! · · Score: 1

      Programs are essentially mathematical descriptions of data manipulations. People make mathematical errors all the time, so it's not surprising that programs, given their size and complexity, have problems being correct at every stage. The issue is not so much that they do have problems, but how quickly they are fixed and put into a usable state.

      The crux is OSS and commercial software differ in what 'usable' means. In OSS, a program can be dysfunctional on many levels and be considered usable. Because it's FREE. Once you start paying for it, the expectations must go up, because you've traded your money for assurances that the product works as advertised, every time. Of course, we know that this is wishful thinking, but the motivation is definitely more compelling when, as a software developer for a corporation, your paycheck depends on it.

      --
      Any connection between your reality and mine is purely coincidental.
    4. Re:Maybe people expect too much from software. by p3d0 · · Score: 2
      One of my friends counters arguments about software being too sloppy with the point that there is practically no other field where a product is designed to be used on such a varying degree of ways and expected to still be robust.
      But there is no other field where it is so straightforward to be robust: just check for error codes. I think that cancels the flexibility issue, and so software shouldn't be any less reliable than any other device.
      The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file. (I will not use it again.)
      How well do cars function when they run out of fuel?
      I don't know about yours, but mine doesn't stop dead and leave the passengers mutilated.
      Now, I'm not trying to excuse sloppy software development...
      Yes you are.
      but the fact of the matter is that software is constantly expected to work perfectly under situations completely outside its specifications yet we don't expect this from other items or appliances that we use.
      No, but I think it's fair to expect that software can tell when it is beyond its specification and fail gracefully.

      If you don't like checking the result of malloc, then write a function that does it for you. When you run out of memory, do your best to exit gracefully. It's not rocket science. It's just tedious, so people don't like it.

      It's also hard to test, because some error conditions may be hard to reproduce. We may be able to take a hint from the hardware crowd, who have been using "design for testability" for some time now.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    5. Re:Maybe people expect too much from software. by Ardax · · Score: 2

      I think that you're trying to link together things that don't really go together in the real world.

      A computer should deal with a scratched CD by going "Uh, garbage data. Don't like that. Shut down system gracefully, don't try to find out the sound of heads on platters."

      If the transmission is screwed up in your car, you don't expect it to crack the drivetrain.

      EVERY piece of software should be checking for sufficient disk space during a WRITE operation. Only fools and dieties do otherwise. You shouldn't blindly try to overwrite the old file with the new and hope it works unless you've got a damn good reason.

      When your car runs out of fuel, you certainly don't expect it to ruin the engine. Give it fuel (or disk space, as it were), and it's happy again.

      There's a difference between dying heroically and taking everyone with you. I don't mind if a program barfs on occasion because of slight variance in the pases of the moon. The software industry is still young and needs to learn more lessons from the engineering industry. I mind when it barfs and takes my data along with it.

      --
      Pax, Ardax
    6. Re:Maybe people expect too much from software. by Fizzlewhiff · · Score: 1

      [i]how is a programmer expected to deal with the CD being scratched? Does your car still work if the transmission is damaged or half the engine has been riddled with bullet holes? [/i]

      A programmer should consider the possibility of a read error on the CD and exit gracefully if the CD or files on the CD cannot be found for whatever reason. Having a fatal error which forces the OS to reboot is just poor.

      The example of Word corrupting a file because the drive filled up is also an example of poor programming. Drives fill up more often than you think. It is something that a programmer should consider. Microsoft had this same problem with either DOS 3.0 or DOS 4.0 but it was much worse than just a file. If you filled up the drive, say goodby to your FAT.

      Also, the car analogy doesn't work with software. It might work with hardware however. Does your PC work if the BIOS is damaged or the CPU is busted in half?

      --

      'Same speed C but faster'
    7. Re:Maybe people expect too much from software. by Gorak · · Score: 1
      let's use a car as an analogy
      Yes, let's.

      The key CD is now scratched which hangs the authenticator forced a quite ungraceful reboot and corrupted my hard drive.

      how is a programmer expected to deal with the CD being scratched?

      Gracefully. You don't blow away half the user's hard drive if you can't read data from somewhere else. You notify them that there's a problem reading the CD, and terminate without further modification. Bad analogy.

      The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file.

      Again, a very unexpected and unnatural scenario. How well do cars function when they run out of fuel?

      Again, bad analogy. Cars function very well when they run out of fuel -- they just don't go anywhere. They don't mutilate the passengers or start filling the fuel tank with weird green goo.

      But how well would your refrigerator react if you treated it shoddily such as by leaving it outdoors intermuitently or diconnecting and reconnecting the power several times a day?
      A damn sight better than your Windoze installation, that's for sure. So do cars, for that matter.

      You want to see graceful and robust? Go look at some embedded systems one day. I mean, really look at them. Things that run elevators, washing machines, cardiac monitors, and so forth. They don't crap out because someone wibbled them in a way the programmer wasn't expecting.

      Plan for every eventuality, even the ones that can never occur.

      --

      I had one, but the wheel fell off.
    8. Re:Maybe people expect too much from software. by Anonymous Coward · · Score: 0

      Yeah, sure, I'll take programming tips from someone that doesn't even know the correct type of bracket to use for HTML tags...

    9. Re:Maybe people expect too much from software. by Anonymous Coward · · Score: 0

      >>How well do cars function when they run out of fuel?

      >I don't know about yours, but mine doesn't stop dead and leave the passengers mutilated.

      It could if you were on the inside lane of an interstate with a high wall twelve inches to your left and cars speeding by your right. The problem is that you would suddenly slow; your power steering would fail; your breaks would only maintain power for a few seconds; cars would zoom around you; some fat dude eating a big mac woud slam into your rear knocking you into trafic or the big wall, and suddenly a big rig would roll right over your no-gas-having ass.

      That is a crash in real life--screwing-up a document is what happens on your pc.

      Ofcourse, the situation that I described could never happen :-).

    10. Re:Maybe people expect too much from software. by datazone · · Score: 1

      i wonder what happens if you mix an explosive chemical with your gasoline and put it in your gastank, then start your engine... wait, i am sure it checks the chemical properties first!

      the fact of the matter is that it is possible to design something to test for every possible situation, however the more complex a system becomes the more complex your testing will also become, then there comes a point when more than 50% of your code is there for testing! Thats all well and good, but if you are writing code for free, and your basic goal is to just get something accomplished, you are going to put in pretty much only as much testing as you "think" you need, unless you got some sick fetish with exception handeling.

      --
      Its spelt "L-I-N-U-X", but pronunced as "Free Beer"
    11. Re:Maybe people expect too much from software. by Bert64 · · Score: 1

      A car will warn you in reasonable time that the fuel is getting low, the "empty" mark usually means there is enough gas for a few more miles anyway, and a responsible driver will ensure he always has enough fuel for the journey he is undertaking.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    12. Re:Maybe people expect too much from software. by Bert64 · · Score: 1

      But if you put an explosive chemical into your gas tank, you do so knowing that you shouldn`t. It`s like opening a program in a hex editor, overwriting random data then expecting it to work. However, i would not expect my car to blow up when i was driving normally, that would simply not be good enough, and i would have the car repaired, and i would seek damages from the manufacturer or the last garage which serviced the vehicle, as they provide a guarantee that the car is functional and safe for normal use.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    13. Re:Maybe people expect too much from software. by gilroy · · Score: 2
      Blockquoth the poster:

      as they provide a guarantee that the car is functional and safe for normal use.

      Ah, only because your garage hasn't discovered the joys of the End User License Agreement.


      Yet.

    14. Re:Maybe people expect too much from software. by armb · · Score: 2

      > > The key CD is now scratched which hangs the authenticator
      > how is a programmer expected to deal with the CD being scratched?
      By not requiring one specific non-copyable CD as a dongle? At the very least, by putting up an error message saying "sorry, I couldn't read that". _Not_ by rebooting and corrupting the hard disk.

      > > a drive filled during a save operation
      > Again, a very unexpected and unnatural scenario.
      No it isn't. That's the sort of attitude that leads to crap code in the first place.

      > How well do cars function when they run out of fuel?
      With most cars, you fill them with fuel again and then they continue working (sometimes you might need your injection system cleaned). Word didn't just fail to save his file, it mangled what he already had.

      --
      rant
    15. Re:Maybe people expect too much from software. by Anonymous Coward · · Score: 0

      your point is really interesting. but i thinks there are some more aspects to this sort of comparison.

      i think the biggest reason why we expect certain things of software is because of the way we see it.

      software is really a deterministic system of strategies, all of which are simple logic; meaning for every strategy there is a flawless, logic solution (in theory). everything the programmer has to do is implement the logic in the form of code (that's not the way it is, that's the way we see it).

      the system this logic takes place in has better conditions than every system in the real world: there are no resources that get used (such as gas in your car), the only "bad" thing that can happen to these implementations of strategies (which equal the assembled parts in your car) is that certain tasks might take more time than others.

      our expectations toward software derive from the fact that we see it as a logic system, not a real-world touchable "machine", and thus we expect it to be deterministic, manageable, controllable.

    16. Re:Maybe people expect too much from software. by Herbmaster · · Score: 2

      One of my friends counters arguments about software being too sloppy with the point that there is practically no other field where a product is designed to be used on such a varying degree of ways and expected to still be robust. For instance, let's use a car as an analogy to your complaints

      That's okay, software more than makes up for this bit by being about the only field where you can be so certain about the environment it's used in. Cars are subject to various terrain conditions than the manufacturer never could have guessed (this could be half the user's fault), and environmental conditions which are rare and possibly very difficult to simulate during the development process (this is not). To prepare a car to theoretically resist any kind of failure you need a really good physics model and lots of really good test cases (lots = billions). Recompiling and testing 1000 times does not even begin to compare to building a car from a new design 1000 times, and testing. And I suspect 1000 tests on a piece of software would probably find/solve many more of the bugs in it.

      Computer softare has all kinds of luxuries here. For one, all input to a piece of software is digital. I hope you understand how much easier this makes bounds/value checking. Software gets to come with hardware and software requirements which it gets to enforce: Oh, you aren't running at least Win98 on at least a PentiumII? I won't run then. Cars come with a manual that says "put 89 octane gas in me. Don't drive me on roads which are unpaved, save the pointy nails littered all over them. Don't drive around on antarctica cuz it's cold there." But if you defy any of these rules, you'll suceed at least part way, and then you can complain to the manufacturer, who will tell you to piss off. It would be really cool to see a car that actually tested the octane of the gas you put in it, and complains immediately if it's incorrect, but I don't see anyone writing an article that auto makers owe us this feature.

      We're not talking about physical damage here. If you throw your hard drive at a lamp post, and then complain to your software vendor that the software doesn't work, you've got issues. But yes, software that corrupts your hard drive (???) because a CD is scratched is totally negligent.

      --
      I'm not a smorgasbord.
    17. Re:Maybe people expect too much from software. by Shotgun · · Score: 2

      Does your car still work if the transmission is damaged or half the engine has been riddled with bullet holes?

      If the transmission is damaged, should the tire go flat for good measure?

      Again, a very unexpected and unnatural scenario. How well do cars function when they run out of fuel?

      How the hell is running out of feul or disk space unnatural or unexpected? By your analysis, if you run out of fuel, your car should explode and the manufacturer could just say, "Heh, he let it run out of gas. He should've gotten a bigger tank."

      But how well would your refrigerator react if you treated it shoddily such as by leaving it outdoors intermuitently or diconnecting and reconnecting the power several times a day?

      I take it outside, the pretty white paint turns yellow. I unplug it, frozen stuff melts...eventually. But I would be PISSED if I unplugged it and the door fell off.

      We can expect more intelligence from computer software, because computer software is more intelligent. A program can take reasonable precautions to check if a step succeeded before trying to use the results of that step, and then give a reasonable error message or take an alternative course if the results were unexpected. Instead we get even less with software than we do with other things. If my car won't start, I can have my wife try to crank it while I listen for strange noises under the hood. If my Windows computer won't start I just get a message about an unexpected operation. (My Mandrake-Linux boxen tell all sorts of things about what's going on as they boot up, so I was easily able to find that IPForwarding wasn't working because I hadn't compiled the correct modules.)

      That said, I've found that the commercial software I've used just dies without ever telling me anything, so I usually have no clue what happened or how to fix it. OSS tends to report a ton of cryptic garbage that I can do a grep on the source code with. I'd be no better off with OSS in most case if it wasn't for the fact that I'm a software engineer by trade.

      --
      Aah, change is good. -- Rafiki
      Yeah, but it ain't easy. -- Simba
    18. Re:Maybe people expect too much from software. by Ziviyr · · Score: 1

      i wonder what happens if you mix an explosive chemical with your gasoline

      Like what? Gasoline? ;-)

      Yes, combustion engines need combusty stuff to work...

      --

      Someone set us up the bomb, so shine we are!
    19. Re:Maybe people expect too much from software. by scrytch · · Score: 2

      how is a programmer expected to deal with the CD being scratched? Does your car still work if the transmission is damaged or half the engine has been riddled with bullet holes?

      The authenticator software can return "Error Reading CD" and not completely lock up and hose everything on the system, perhaps?

      How well do cars function when they run out of fuel?

      They stop. When you fill them up with gas, everything is fine again, no permanent damage is done. This is a simple and extremely common boundary condition that the automobile manufacturers account for. Running out of space is also a common condition that should simply result in a denied operation, not corruption of data.

      But how well would your refrigerator react if you treated it shoddily such as by leaving it outdoors intermuitently or diconnecting and reconnecting the power several times a day?

      Your analogies are getting very thin. The fact that computers are designed for more varied conditions of their runtime environment should not excuse them from being robust in the face of that fact.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    20. Re:Maybe people expect too much from software. by Anonymous Coward · · Score: 0

      > how is a programmer expected to deal with the
      > CD being scratched?

      Maybe instead of writing code like this

      // do something before
      read(code from CD);
      // do soemthing after

      the programmer should write

      // do something before
      if read(code from CD) has not succeeded after X amount of trying, give an error message and give up,
      else
      // do something after

      I would hope it's standard coding procedure not to assume that you can cross your fingers and I/O will always work...

    21. Re:Maybe people expect too much from software. by Stardance · · Score: 1

      From the text to which you replied (and quoted): ".... The key CD is now scratched which hangs the authenticator forced a quite ungraceful reboot and corrupted my hard drive. (Perhaps a $150 upgrade will help. I'll never know.)"

      IMHO, you mistate the case to suggest that the software designer cannot be expected to anticipate that the CD is "now scratched", because the designer does not need to anticipate that. Rather, s/he must anticipate that _devices_ can and will malfunction and fail in any of many ways, whatever the cause, and make provision for such eventualities in the software. IMX, it isn't that hard to do. :-0

      ".... The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file. (I will not use it again.)"

      There is scant excuse for Word, or any other program, to fail to handle an exception such as that. Then again, a prospective "disk full" situation is not necessarily easy for an application program to detect before it begins sending the file system (operating system) the data to record. What the application can do depends upon the operating system. However, what the OS is probably going to do is tell the application that the file-write has failed, after the fact (whether it also indicates why), so the application must be designed to prevent loss of the file in that context.

      That said, I understand your point, although I seldom encounter a situation in which the software (designer) can or should be "excused" for its malfunction or failure. My two cents.

      --
      nil carborundum illegitimi
    22. Re:Maybe people expect too much from software. by Cro+Magnon · · Score: 1

      To use your running out of gas scenario: When I get very low on gas a red light comes on on my dashboard. I can still drive quite a ways before dying on the road. When I'm running very low on HD space, there is no such warning. I just keep chugging along until I have this 15 page report that the boss wanted yesterday. I type in the whole thing without saving, then when I have it finished I click save, and get error messages at best, or data corruption at worst.

      --
      Slow down, cowboy! It has been 4 hours since you last posted. You must wait another few hours.
    23. Re:Maybe people expect too much from software. by PurpleKarma · · Score: 1
      Again, a very unexpected and unnatural scenario. How well do cars function when they run out of fuel?

      Not quite the best analogy. Every car I've owned will try to warn you when you've got under 5 litres of fuel remaining in the tank; if the driver keeps going, it becomes the driver's problem. In other words, each car I've owned has been designed to deal with a "low fuel level" exception.

      By the same token, any reasonable car will warn you when you have a low oil level and better cars will warn you when you're low on washer fluid.

      Granted, if the car runs out of fuel, the car will cease to move (IMHO analogous to an application "crash" or "freeze"), but the system at least generated an advance warning.

      --

      --
      eek. eek. eeeeeek. eek-eek.
  83. Hrmm by NitsujTPU · · Score: 2, Insightful

    First let me say that I am a Linux user and an open source advovate.

    Now let me compare this to a judge I once met, who said that men have more tickets in general, but women always follow too close.

    This is interesting, but if we further evaluate, one could conclude that women are just as bad (equally so), but perhaps people were lighter on them along the way. A police officer might have let her off, and so forth (this isn't to sound mysogynist of course, but I know women who get let off all of the time).

    Instead, following too close is an easy prelude to... an accident. After all, when your bumpers are crushed together, you're too close.

    Now think of error handling. "Open Souce Software handles errors poorly," is another way of saying that it too crashes a lot. Perhaps other people get caught for other things, but we only rag on open source when it crashes.

    This isn't to say ALL open source software though.... but lets be perfectly honest. Programming is a difficult profession that a lot of people think they can just pick up. How many people would volunteer to do surgery without med school because they read a book on the subject? How many people get offended when you flash some important programming credentials in front of them that they don't have?

    The trick is sifting the wheat from the chaff. Sure, a 14 year old with a little ambition can whip up a pretty impressive looking windowed program in X... but he doesn't have the sophistication of a well educated programmer... generally. There are plenty of good programmers and bad programmers in open source. The key is to know whats good and whats bad. If you can't figure that out, then buy a distro made by people who do.

  84. Prevent errors before they happen by ByTor-2112 · · Score: 1

    I always find that if I am testing for tons of possible errors deep in my code that what really needs to happen is some minor logic changes at a higher level that make the error conditions impossible to exist.

  85. No kidding... by X · · Score: 2

    Heh, the link to the site gives me a Proxy Error. ;-)

    --
    sigs are a waste of space
  86. THAT is your answer? by Nindalf · · Score: 2

    Exceptions make sure that if an error occurs, and you aren't aware of it, your program dies, and doesn't go on its merry way, causing a security hole/unstable software.

    You mean like that Ariane rocket that blew up when its double-redundant computer system was halted because of an utterly irrelevant uncaught exception? Yeah, that's definitely a superior error-handling philosophy.

    Aside from the conceptual problems of what are essentially COMEFROM statements with scope management, there's no reason to assume that halting the program is better than just allowing it to run.

    1. Re:THAT is your answer? by ftobin · · Score: 2

      You mean like that Ariane rocket that blew up when its double-redundant computer system was halted because of an utterly irrelevant uncaught exception? Yeah, that's definitely a superior error-handling philosophy.

      I'm not familiar with the rocket you describe, but yes, it is a superior error-handling philosophy. Imagine if there was an unchecked error, and the rocket, instead of detonating, landed in civilian housing? That's precisely what not using exceptions allows for: programs that become destructive because of lack of error management.

      Aside from the conceptual problems of what are essentially COMEFROM statements with scope management, there's no reason to assume that halting the program is better than just allowing it to run.

      That's like saying there's no reason to assume knowing about a bug is better than just allowing a program to go on its merry way. Uncaught bugs are the cause of 99% of the security holes out there. It's always better to know when there is a problem.

    2. Re:THAT is your answer? by DaveV1.0 · · Score: 1

      If you are referring to the Ariane 5 rocket that self-destructed shortly after lift-off, you have the wrong error. The problem was reusing the code without testing it properly for the new system.

      The problem was that the variable containing the acceleration was not large enough to hold the actual number. The Ariane 5 was more powerfull and had higher acceleration than the Ariane 4, which used the code in question with out a problem.

      Basically the variable should have been changed from int to long. But, because the software was not retested with new maximum values, the problem went undetected.

      When the value exceded the max size of int, the value went negative and the computer thought the rocket had flipped and auto-destruct was triggered.

      This as a problem with the testing of the software. The error checking or exception handling worked perfectly.

      --
      There is no "-1 offended" or "-1 you don't agree with me" mod options for a reason.
    3. Re:THAT is your answer? by Nindalf · · Score: 3, Insightful

      I'm not familiar with the rocket you describe, but yes, it is a superior error-handling philosophy. Imagine if there was an unchecked error, and the rocket, instead of detonating, landed in civilian housing?

      Why would you assume the rocket was intentionally detonated by the computer? Its computers went down and it went completely out of control. It was only blown up after it broke apart because it happened to go into a spin. There is no upside to this computer failure.

      You call blowing up a commercial satellite launch vehicle non-destructive? If this error was ignored the rocket would not have been affected by it, it was an utterly irrelevant mathematical value overflow error in a program that only did anything before launch.

      This program became destructive because of the "error management." In particular, the error management philosophy that halting a suspicious system is always safer than allowing it to run.

      The point you seem to have missed is that halting the program is often more destructive than ignoring the error. Data loss, control loss, vital services suspended, etc.

      That's like saying there's no reason to assume knowing about a bug is better than just allowing a program to go on its merry way. Uncaught bugs are the cause of 99% of the security holes out there. It's always better to know when there is a problem.

      I'm sure the European Space Agency found it worth every penny of the estimated half-billion dollars lost to find this otherwise irrelevant bug. After all, it's always better to know, whatever the cost of halting the system, right?

    4. Re:THAT is your answer? by dvdeug · · Score: 2
      The code was designed for the Ariane 4; due to money and political reasons, none of the programmers knew it was going to be used for the Ariane 5, and no one ever checked to see if it would work right for the Ariane 5. Pretty nasty circumstances. If I understand the case correctly, it was a hardware exception, not a software exception, in any case.



      what are essentially COMEFROM statements with scope management



      And for loops are essentially if-goto statements. The added structure is what makes them useful.



      there's no reason to assume that halting the program is better than just allowing it to run.



      So you would prefer a hacker gain root because of a buffer overflow, rather than the attempt crash your webserver? A lot of the exception-causing problems, if just left to run, will spew garbage and crash, exchanging clear debugging info for a few microseconds of trash. If it's important that it continue to run, I can put a exception net at any level (esp. the highest level) and restart whenever an exception is caught, possibly taking different code routes.

    5. Re:THAT is your answer? by Nindalf · · Score: 2

      When the value exceded the max size of int, the value went negative

      Yes, but...

      and the computer thought the rocket had flipped and auto-destruct was triggered.

      ...no, this is simply wrong. Where did you get this idea? A simple search on google will let you confirm the inaccuracy of this claim with a dozen independent sources. The code in question served no purpose in the air, it was used to align the rocket on the ground. The flight software worked perfectly.

      When it went negative, it failed an assertion and threw a math exception. The system read this as "this chip is fried" and shut it down. Then, because the 2 redundant backups were running the exact same programs with the exact same data, it did this twice more. With the computers down, the rocket went wild, and then blew up.

      Like most disasters on this scale, many mistakes had to be made simultaneously. If they had stopped running this irrelevant code on launch, it would have been fine, if they had used a larger integer, it would have been fine, if they had used Ada's integer protection, it would have been fine, if they had caught the exception, it would have been fine.

      But the things that gets me are 1) that the system was set up not to pass control from a seemingly defective chip to a seemingly good chip, but to yield control from any seemingly defective chip, whether there was another good chip or not and 2) any uncaught exception (not just a specific "We're really sure there's a hardware problem." exception) was taken as proof that the chip was defective. These were both well-known, meaning that there was a concious, considered decision that it was better to halt the system, and completely shut down the guidance system (the only possible result of an uncaught exception due to a software bug) than to face the unknown consequences of running despite an exception they didn't think to catch.

      The blame lies with all of those flaws, not just one or two of them. It indeed also lies with the testing that didn't catch it and the decision to reuse legacy code of an older, slower rocket. But note that most of the direct causes were consequences of the exception-handling style of error-handling, and the single most direct cause was a mechanism inspired by the specific belief that halting the system was better than allowing it to run with any one unknown flaw.

    6. Re:THAT is your answer? by dvdeug · · Score: 2

      This program became destructive because of the "error management."

      This program became destructive because of poor managers. Any test would have shown that the rocket would tilt more than the computer could handle. The reason the computer couldn't handle it was because it wasn't designed to run on that rocket, and no one bothered to check to see if it could run on that rocket. (That exception couldn't have been raised on the Ariane 4 so the check was removed because they didn't have the spare cycles.) On the Ariane 4 (the rocket it was designed for) it worked fine.

      It's like ripping a heat sink off a CPU and blaming the CPU for melting down. Maybe the CPU should run cooler, but the big problem was that the CPU was never designed to run without a heat sink.

      Data loss, control loss, vital services suspended, etc.

      Like you can't get all of those by ignoring exceptions. When a hacker tries a buffer overflow, I'd prefer my webserver to crash rather than give him root. I'd rather a program crash with a pointer to the bug (where the exception was thrown) then just spit garbage and hang or crash. Either way it's dead, but one way is a clean, safe, informative death.

    7. Re:THAT is your answer? by radish · · Score: 2


      When you're dealing with something which could quite easily kill 500 people if it landed in the right place, you bet you need to err on the side of caution. I studied this exact case a few years back, and the rocket was auto-destructed by the safety systems directly because of the exception. This was 100% correct - if you are not totally sure that everything is perfect, you abort. The actual reason for the failure was bad management and testing practise, which allowed a system designed & tested for a different launch vehicle to be used to "save money". Blame accountants & PHMs!

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    8. Re:THAT is your answer? by robot_guy · · Score: 1
      It's like ripping a heat sink off a CPU and blaming the CPU for melting down. Maybe the CPU should run cooler, but the big problem was that the CPU was never designed to run without a heat sink.

      Noting that Intel Pentium III chips are not damaged by the heatsink being removed in operation (the clock is stopped if the temperature gets too high) and Pentium 4 continues to work perfectly because the clock is automatically throttled to control temperature. See the test at Toms hardware.

    9. Re:THAT is your answer? by TrixX · · Score: 2

      The Arianne exploded because the "horizontal bias", a 64 bit floating point number, was converted to a 16 bit signed integer producing an exception, because the conversion overflowed.

      That exception was CAUGHT BY A HANDLER. The program didn't stop. But the handler above the faulty routine had no information about how to correct the problem, and given that the rocket was going off course, it self-destroyed (yes, that's a security measure).

      So, the exception handling was used, and served its purpose of error-handling. The error, was using a 16 bit integer, that was not enough (they used that because they reused the code that they had used for the Arianne 4, whose trajectory had a bias that fitted into a 16bit signed int). If the rocket program would have continued, the arianne could've have crushed over some population. killing a lot of people.

      So:
      1) The program didn't stop abruptly (that's what exceptions are for, controlling program stop)
      2) The exception mechanism possibly saved a lot of lives
      3) The program did a reasonable work and ended in an expected way very well for a program with critical bugs in it.

  87. Something to think about... by Anonymous Coward · · Score: 0

    What percentage of Open Source programmers are commercial programmers in their day jobs?

  88. My Ass by Greyfox · · Score: 2
    I've seen (and done) a lot of commercial and custom programming for business. I've dug through a lot of open source software. Open source software wins hands down every time. Open source programmers like to code. You will find that a lot of people who are programming professionally do so because the salaries are good. They're mediocre programmers at best and their code reflects that.

    Open source programmers may suck at handling errors, but commercial programmers suck much more.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  89. fa! by Anonymous Coward · · Score: 0

    No, I don't. "Alpha" versions of open source programs do obviously. But the commercial software I'm used to (Windows) can lock up the system. Don't know if its the fault of the apps or waht, but...

  90. LinuxWorld programmers Stink At Error Handling by mprudhom · · Score: 1

    Oh the irony. http://www.linuxworld.com/site-stories/2001/1025.e rrorhandling.html yields:

    Proxy Error
    The proxy server received an invalid response from an upstream server.

    The proxy server could not handle the request GET /site-stories/2001/1025.errorhandling.html.

    Reason: Could not connect to remote machine: Connection refused

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  91. languages need better error handling built in by EccentricAnomaly · · Score: 1

    I think there is a definite need for a high level language with strong error handling. Stuff like automatic checking for buffer overflows on all input and output, automatic checking of data types on every instance where a variable is used - and built in units checking, i.e., a formula needing inputs of feet will automatically convert from meters and not allow you to input something of units of pounds or seconds (only units of length).

    I'm sure there's lots more error checking that could be built into a language that would be a bitch to get through the compiler or interpreter, but would make a program more trusted in the end.

    We could call it "anal"...

    --
    There are 10 types of people in this world, those who can count in binary and those who can't.
  92. Zen GET by isomeme · · Score: 2, Funny
    What is the sound of one LinuxWorld story illustrating its own point, grasshopper?
    Proxy Error
    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request
    GET /site-stories/2001/1025.errorhandling.html.
    Reason: Could not connect to remote machine: Connection refused
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    ...and in that moment, he became enlightened.

    --
    When all you have is a hammer, everything looks like a skull.
  93. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  94. JBoss vs. WebSphere by Fuseboy · · Score: 1

    A recent experience with JBoss had me cursing open source software for this very reason. I'd accidentally declared a JBoss-persisted field 'private' instead of 'public' (as we later found), but JBoss' not-so-helpful response was to throw a NullPointerException. Ironically, I discovered by reading the source that it was actually bombing while trying to construct a more helpful error message!

    It was helpful, however, to compare this with an earlier experience with WebSphere 3.0. Whenever you did any number of incorrect actions in the management GUI (such as giving two servlets the same URL), it brought up a nice little dialog with a similarly inpenetrable RemoteException stack trace. Useful!

    The only pratical difference between the two was that JBoss' cryptic message could be deciphered by reading its source code.

  95. Bastard operator from hell error handling by Spootnik · · Score: 1

    When a luser complains about error messages, I punch him in the face. I'm getting less and less bug reports that way.

  96. Dumb programmers... by Anonymous Coward · · Score: 0

    Here is a pwd that will never dump core, barring faulty memory:

    #include <stdio.h>
    #include <unistd.h>
    #include <limits.h>

    int main() {

    char buf[PATH_MAX+1];

    if( !getwd(buf, sizeof(buf)) ) {
    perror( "getwd" );
    return 1;
    }

    puts( buf );
    return 0;

    }

    1. Re:Dumb programmers... by Anonymous Coward · · Score: 0

      Correction: s/getwd/getcwd/

  97. Graceful degradation by PollMastah · · Score: 3, Insightful

    I agree with you that software in general is a lot more complex, and used in a lot more unexpected ways, than something like a car.

    OTOH, there is such a thing called graceful degradation -- that is, if you push the limits of the software, it shouldn't just suddenly barf and die on you, but degrade gracefully. Too much code I've seen (both open and non-open source) assumes too much -- and dies badly when the assumptions fail.

    It is possible and not overly difficult to design software such that it degrades gracefully. Sadly to say, sloppy programming (programmers), deadline pressure, or disinterest in handling error conditions, dominate the world of software. Not many would put in the extra work to make a program degrade gracefully, because it doesn't have very visible effect -- until things start to fail. And too many programmers have this "test only the cases that work" syndrome.

    --

    Poll Mastah

    1. Re:Graceful degradation by pmz · · Score: 2

      A good example of graceful degradation is the behavior of a good UNIX kernel as virtual memory is exhausted. It still works, although slowly, since there are well-thought-out mechanisms to keep the system going.

      Another example would be the Internet. It is designed to still work after much of it has been destroyed.

  98. Commercial Pressures by snorkle · · Score: 1

    I would contend that Commercial Pressures (tm) cause a *lot* of closed source programs to be released without this kind of error checking. I'm not saying it's OK to write code without error checking, but that the reality of it is that a lot of commercial software is released without error checking.

    Open Source software is quite often developed by the programmer with a view toward 'correctness' rather than a view toward a July 16 release date (or whatever). It is this software that I would expect to have a lot of 'good' error checking. A lot of other Open Source software, however, is developed by a programmer for personal use, then released to the community because 'others might find it useful'. It is this software that is likely to have less stringent error checking (not always, but less likely).

    So, sure, some OSS will have lax error checking, but there is an awful lot of OSS with exceptional (pun intended) error handling.

    I think the generalization is gross at best, and inaccurate and wrong at worst.

  99. Re:That all depends on... your selection of course by Jubedgy · · Score: 1

    he was quoting from an article about IIS security flaws...it was a comment from a M$ spokesman claiming that the supposed buffer overflows were completely theoretical and could NEVER happen (I believe that's what he said, anyway)

    --Jubedgy

    --
    Si hoc legere scis nimium eruditionis hebes
  100. ammusingly enough... by toastee · · Score: 1

    Not Found
    The requested URL /site-stories/2001/ was not found on this server.
    Additionally, a 404 Not Found
    error was encountered while trying to use an ErrorDocument to handle the request.

    You get the above when you try to access that url on the server hosting the above document. Ironic? I think so. Maybe linux journal should handle it's own webserver's errorhandling before blasting others?

    --
    - Better to speak your mind than to remain silent, or someone may speak for you.
  101. Depends upon the application by Adam+Wiggins · · Score: 2
    The "proper" sort of error handling varies wildly depending on the application type. For example:
    • A game should pretty much always abort if anything goes wrong. Missing or corrupted datafiles, etc. Diagnoic information will only be useful to programmers, so no need to make it terribly user friendly - just tell them to resintall the game.
    • A server application should give detailed messages which go to a logfile, pinning down exactly what it was trying to do, and what line it was on if parsing a file.
    • A productivity application can go easy on the diagnostic information, like a game, but being able to recover gracefully is far more important. At the very least, allowing the user to save their data before they restart the program.
    • A viewer-type program should be able to recover gracefully and just fill the area it can't parse or that is causing a problem with a blank space or something. Like a web browser that can't load a picture. If it's something like a file viewer that can't load a certain font, it should be able to fall back to a default font so that the document is still readable.


  102. The error handling challenge by TrixX · · Score: 2

    you think checking return codes is the solution? Well, it is but at a cost.

    Exercise for /. readers: add errorchecks to the following C function. 'return' and exception handling pseudocode allowed:


    int allocate_3(void){
    int *p1, *p2, *p3 ;

    p1 = malloc(SOME_NUMBER*sizeof(int)) ;
    p2 = malloc(SOME_NUMBER*sizeof(int)) ;
    p3 = malloc(SOME_NUMBER*sizeof(int)) ;

    /* Here we do something with p1, p2, p3 */

    free ( p1 ) ;
    free ( p2 ) ;
    free ( p3 ) ;
    return 0 ;
    }

    Let the game begin...

    1. Re:The error handling challenge by addaon · · Score: 1

      I'm a java programmer, so I prefer exceptions... but what's the big deal?

      int allocate_3(void){
      int *p1, *p2, *p3 ;

      if( !(p1 = malloc(SOME_NUMBER*sizeof(int)) )) return -1;
      if( !(p2 = malloc(SOME_NUMBER*sizeof(int)) )) return -1;
      if( !(p3 = malloc(SOME_NUMBER*sizeof(int)) )) return -1;

      /* Here we do something with p1, p2, p3 */

      if( p1 ) free ( p1 ) ;
      if( p2 ) free ( p2 ) ;
      if( p3 ) free ( p3 ) ;
      return 0 ;
      }

      --

      I've had this sig for three days.
    2. Re:The error handling challenge by Mr.+Barky · · Score: 1

      Here's my code. I had to remove some white space due to slashdot's "compress filter" rejection.

      #define FAILED (xxx) // depends on program
      #define ERRCHECK(a) if(FAILED(rc=(a))) goto ReturnResult;

      int MyMalloc(int size, void **p)
      {
      *p = malloc(size);
      if (!*p)
      return ERR_MEMFAIL;
      return ERR_SUCCESS;
      }

      int allocate_3(void){
      int *p1=NULL, *p2=NULL, *p3=NULL;
      int rc = ERR_SUCCESS;

      ERRCHECK(MyMalloc(SOME_NUMBER*sizeof(int),&p1));
      ERRCHECK(MyMalloc(SOME_NUMBER*sizeof(int),&p2);
      ERRCHECK(MyMalloc(SOME_NUMBER*sizeof(int),&p3);
      /* Here we do something with p1, p2, p3 */
      ReturnResult:
      if (p1) free(p1);
      if (p2) free(p2);
      if (p3) free(p3);
      return rc;
      }

    3. Re:The error handling challenge by Mr.+Barky · · Score: 2

      If the alloc of p2 or p3 fails, then you have a memory leak.

    4. Re:The error handling challenge by TrixX · · Score: 2

      The big deal is: you have an intermediate non-stable state.

      So, suppose the first malloc succeeds, but the second one fails.

      In that case, you have allocated p1, buth then 'return -1'. That results in a memory leak, because you never freed p1.

      There's one big point for garbage collection, btw. But, the same would happen with fopen()/fclose()
      I posted this to show what the more common mistakes are. Yours is on the list (I've seen it zillion of times)

    5. Re:The error handling challenge by reflective+recursion · · Score: 1
      There's one big point for garbage collection, btw.
      Not always. There is a kind of garbage collector known as "conservative." This type of collector actually does _not_ free all memory not in use. The famous Boehm collector for C/C++ uses a conservative method. The tradeoff is you generally get most memory free and extra speed at a cost of having unused memory still allocated from the OS (and the program could potentially use all existing memory). But, I really think this point is moot. If the program cannot allocate memory, it most likely will quit anyhow. If your program is complex enough to know when it runs out of memory _and_ that it has memory in use it does not need, well it is practically a garbage collector itself and would probably be better off using a higher level language with exceptions and a GC or something.
      --
      Dijkstra Considered Dead
    6. Re:The error handling challenge by treat · · Score: 2

      I must say that this is so completely and utterly classic. It is similar to when people correct someone's "grammer".

    7. Re:The error handling challenge by TrixX · · Score: 2

      > would probably be better off using a higher level
      > language with exceptions and a GC or something.

      That's right. That's why I started this thread as a critique to all the people that said "well, checking return codes is enough".

      When you run out of memory, you probably will quit, but it would be nice to do some some cleanup, like closing connections and files, saving the user unsaved work (or doing a backup), removing locks, etc. A "if (broken) exit(1)"approach is terrible at this.

    8. Re:The error handling challenge by csbruce · · Score: 2

      int allocate_3( void )
      {
      int *p1=NULL, *p2=NULL, *p3=NULL;

      p1 = malloc( SOME_NUMBER * sizeof(int) );
      p2 = malloc( SOME_NUMBER * sizeof(int) );
      p3 = malloc( SOME_NUMBER * sizeof(int) );
      if (p1==NULL || p2==NULL || p3=NULL) goto ERR_EXIT;

      /* Here we do something with p1, p2, p3 */
      if (ran_into_error) goto ERR_EXIT;

      SaneFree( p1 );
      SaneFree( p2 );
      SaneFree( p3 );
      return 0 ;

      ERR_EXIT:
      SaneFree( p1 );
      SaneFree( p2 );
      SaneFree( p3 );
      return -1
      }

      void SaneFree( void *ptr )
      {
      if (ptr != NULL) free( ptr );
      }


      Here is some text to avoid stupid 'Your comment violated the "postercomment" compression filter. Try less whitespace and/or less repetition. Comment aborted.' lameness filter.

    9. Re:The error handling challenge by TrixX · · Score: 2

      I like this one a lot more... A lot of people will think the macros/goto are dirty, but they are actually providing a little exception handling capabilities. what you've done is simmilar to BetterC (see here).

      But that is for my point that some exception handling is needed to do clean error checking in almost all non-trivial cases.

      I like the initializing of p1,p2,p3. Initializing all vars helps to avoid heisenbugs, at a minimal efficiency cost.

      I would've done free(p1), without the if(); free(NULL) is perfectly valid. But that's hard to know without a DBC approach (where you have info on pre/postcondition of your functions).

    10. Re:The error handling challenge by TrixX · · Score: 2

      One note: your "Sanefree" is 100% equivalent to ANSI free() (whose standard behavior on a NULL pointer is to do nothing).

      Another "goto" approach. Dijkstra would throw up here, but what are you doing is like a crude exception handling. And people said "checking return codes is enough"...

    11. Re:The error handling challenge by Mr.+Barky · · Score: 1

      The initializing of variables is required (except maybe p1). Otherwise if the p1 or p2 allocations fail, the program will pass an uninitialized variable to free().

      I like having the "if" statement. It's a consistency thing. The style of code can be used with other "allocate" functions that don't allow NULL or the equivalent on the free routine and I like making it consistent.

      One thing I don't like about your sample allocate_3 routine is the fact that you need to call free routines twice:

      CALL ( FREE(p1) ) ;
      CALL ( FREE(p2) ) ;
      CALL ( FREE(p3) ) ;
      PROCEDURE_RESCUE
      /* This is executed when there is a problem in the body */
      CALL ( FREE(p1) ) ;
      CALL ( FREE(p2) ) ;
      CALL ( FREE(p3) ) ;
      PROCEDURE_FAILURE

      I like to always execute the same free routines whether or not there is an error. That way you don't forget to free something in one branch or the other (or if you do, you forget in both branches and it's easier to detect = fewer bugs). If you want to return an allocated variable, then set p1 = NULL just before ReturnResult.

      One of these days, I'm going to write my own C style guide.

    12. Re:The error handling challenge by csbruce · · Score: 2

      Another "goto" approach. Dijkstra would throw up here, but what are you doing is like a crude exception handling..

      I prefer "simulated exception handling". ;-)

      W.r.t. Dijkstra, the alternative would be bullshit condition variables, extra control structures, and multiple instances of clean-up code, which would be significantly less readable and maintainable.

    13. Re:The error handling challenge by DahGhostfacedFiddlah · · Score: 1
      My solution?

      int allocate_3(void){
      int *p1, *p2, *p3 ;

      p1 = malloc(SOME_NUMBER*sizeof(int)) ;
      p2 = malloc(SOME_NUMBER*sizeof(int)) ;
      p3 = malloc(SOME_NUMBER*sizeof(int)) ;

      if (!p1 || !p2 ||!p3) {
      free (p1);
      free (p2);
      free (p3);
      return (-1);
      }

      /* Here we do something with p1, p2, p3 */

      free ( p1 ) ;
      free ( p2 ) ;
      free ( p3 ) ;

      return 0 ;

      }

      How often do you do this though, without a bunch of pointers being for the same use? Arrays to the rescue, in that case.
    14. Re:The error handling challenge by TrixX · · Score: 2

      > The initializing of variables is required (except
      > maybe p1). Otherwise if the p1 or p2 allocations
      > fail, the program will pass an uninitialized
      > variable to free().
      They wouldn't be uninitialized. They would be NULL, because that's what malloc returns in case of failure, and you assign the result of a malloc to the 3 pointers (that means, you have valid pointers xor NULL).
      The repetition is frequent, that's true. But it's a better solution than creating a language pseudostructure for using when I need the same code, and another for when I don't need different code.

      One usual case of different code is object constructors. The constructor starts creating a structura, and if it fails in the middle, it has to free it all; but when it finishes correctly it has to free nothing. The approach above works. I've been using it for years and I don't use a debugger.

    15. Re:The error handling challenge by Grail · · Score: 1

      The problem being that many C libraries are not ANSI compliant, and using free(NULL) will cause a segmentation fault.

    16. Re:The error handling challenge by epeus · · Score: 2

      Close, but still messy.

      #include"MacErrors.h"

      OSErr allocate_3( void )
      {
      OSErr err=noErr;
      int *p1=NULL, *p2=NULL, *p3=NULL;

      p1 = malloc( SOME_NUMBER * sizeof(int) );
      p2 = malloc( SOME_NUMBER * sizeof(int) );
      p3 = malloc( SOME_NUMBER * sizeof(int) );
      if (p1==NULL || p2==NULL || p3=NULL) {err=memFullErr; goto bail; }

      /* Here we do something with p1, p2, p3 and set err*/
      if (err) goto bail;
      bail:
      free( p1 );
      free( p2 );
      free( p3 );
      return err;
      }



      In MacErrors.h OSErr is typdef'd to short, and the error constants are defined.

    17. Re:The error handling challenge by addaon · · Score: 1

      Ah, cute, I didn't see that. Shows how long I've been away from C... about three years now. Three years ago I would have slapped myself for doing something so silly... today I just say "gee, I feel sorry for those C programmers." Of course, garbage collection (Java's garbage collection is not conservative... but do even conservative garbage collectors have problems with non-circular structures?) would make the issue moot, as you say... and I see that exceptions make it, perhaps, a tad prettier, but certainly not much. How about C# new 'using' word? (Yes, I know that C# is garbage collected... that's not the point. I'm just trying to understand this new keyword, and whether it has any advantages over try/finally.) Would that help at all?

      --

      I've had this sig for three days.
    18. Re:The error handling challenge by tree_frog · · Score: 1

      I'm just yabbering here, but...
      In the solutions to this problem that I have seen, where is the check to ensure that SOME_NUMBER*sizeof(int) does not overflow the size_t type, and cause an area of memory of the wrong size to be returned?

      Of course, this could be caught in the error handling of the /* do something */, but surely it would be better to be caught and flagged up earlier rather than later... where it was obvious that this was the problem, rather than having an array access (for example) die in the middle of a valid range.

      Best regards

      Tree_frog

    19. Re:The error handling challenge by pipacs · · Score: 1

      There is propably no point to continue with
      malloc-ing if a previous one fails. And having
      the clean-up code duplicated may lead to
      maintenance problems.

      What I would do:

      int allocate_3(void) {

      int *p1, *p2, *p3;
      int error = 0;
      p1 = p2 = p3 = (int *)0;

      p1 = malloc(...);
      if (!p1) {
      error = 1;
      goto cleanup;
      }

      p2 = malloc(...);
      if (!p2) {
      error = 1;
      goto cleanup;
      }

      p3 = malloc(...);
      if (!p3) {
      error = 1;
      goto cleanup;
      }

      /* Here we do something with p1, p2, p3 */

      cleanup:
      if (p1) free(p1);
      if (p2) free(p2);
      if (p3) free(p3);
      return error;
      }

      Other people, fearing of gotos, would prefer
      putting the mallocs into a for(;;) loop, breaking
      out when something goes wrong (and at the end,
      of course). I don't like this but I consider it
      as a valid alternative. The goals are the same in
      both cases: avoid nesting in the code, and avoid
      duplicating the cleanup handler.

    20. Re:The error handling challenge by TrixX · · Score: 2

      > I just say "gee, I feel sorry for those C
      > programmers." Of course, garbage collection
      > (Java's garbage collection is not conservative...
      > but do even conservative garbage collectors have
      > problems with non-circular structures?)

      There are complete garbage collectors that get anything that's not referenced directly or indirectly from the "roots" (global vars and stack).

      Anyway, my do that again with an open/close on any resource... a GC works just for memory. Files usually are automatically closed at end. But open/close transactions with more complex objects, possibly externals would bring the same problem: nice error checking is very hard to do in C. It's possible, but the language make it lots harder than it should. So most people get lazy and don't do it at all. Given that C is one of the main languages in OSS, the title of this article didn't surprise me at all.

    21. Re:The error handling challenge by TrixX · · Score: 2

      wow, you got me! I've posted the problem and haven't thought about that.

      I hope what has happened in this thread raises my point for exceptions. The only clean, not deeply nested solutions were using goto's in a form of exception handling. The "die if xxx"/"if (xxx) return -1" school is not enough for good error handling.

      With exception handling and a good DBC mechanism, you would have:
      * overflow raises exceptions, which would have caused an exception that would've been caught, and the memory freed. This is, I'm handling appropiately an error I hadn't thought of.
      * not enough memory, or other possible errors also produce exceptions and are nicely cleaned up.
      * using a different channel to report success/failure and to return results leads to less confusion:

      consider the case SOME_NUMBER was 0. perhaps, if the "do something" part does a loop on the arrays form 0 to SOME_NUMBER -1, it is valid (it would do nothing). malloc(0) returns NULL (see ANSI standars), so we would have treated that as an error (by checking if (!malloc()){... ) when it is not.

    22. Re:The error handling challenge by rpk · · Score: 1
      Garbage collection helps but doesn't solve all the problems. For example, some code needs to behave well in the presence of exceptions even if it doesn't handle them. Take this Java example:
      NuclearReactor aReactor = null;
      boolean aNormalShutdown = false;
      try {
      aReactor = new WaterCooledReactor("seabrook");
      aReactor.start();
      aReactor.monitor(); // hang around until it stops
      aNormalShutdown = true;
      }
      finally {
      if (null != aReactor) { aReactor.shutdown(aNormalShutdown); }
      }
      Yes, I could write a finalizer that shuts down the reactor but this is something I want to happen right away !

      By the way, my number one problem with C++ error handling is the lack of a finally feature. If you want a block of code to be aware of exceptions while not actually trapping them, you have two choices:

      1. Catch all exceptions, then rethrow. The problems with this approach is that any C++ value (including numbers and any kind of pointer) can be an exception, and even among C++ classes there is no guaranteed base exception class
      2. Embody the action to be protected in an object; its constructor performs setup, while the destructor (which will always be executed as the stack unwinds) does the cleanup. This is actually a very nice design pattern, but a lot of people can't wrap their heads around it, and it's kind of verbose for one-off situations.
    23. Re:The error handling challenge by pricedl · · Score: 1
      By the way, my number one problem with C++ error handling is the lack of a finally feature. If you want a block of code to be aware of exceptions while not actually trapping them, you have two choices:
      1. Catch all exceptions, then rethrow. The problems with this approach is that any C++ value (including numbers and any kind of pointer) can be an exception, and even among C++ classes there is no guaranteed base exception class
      You don't need to have a base type for exceptions. This is what catch(...) is for.
      try {
      // stuff that could throw
      }
      catch(...) {
      // my cleanup, which isn't dependent on the exception
      throw; // optional, of course
      }
    24. Re:The error handling challenge by J.+Random+Software · · Score: 1

      Stroustrup advocated the Resource Acquisition Is Initialization pattern in the canonical C++ manual. It's practically what destructors are for. Anyone who didn't understand that book just isn't qualified to use the language.

    25. Re:The error handling challenge by statusbar · · Score: 2

      Very good question. Some people here actually got good solutions that appear to work without memory leaks.

      HOWEVER

      The next step is to take the platform into account!

      Let us run the code on Linux.

      GUESS WHAT? malloc() will almost never ever return 0 under Linux!!! Even when there is NOT enough memory (phys+swap) available! Try it! Allocate 100 megs 5 times on a system with 256 megs of ram+swap. It works.

      It is a 'feature' called memory overcommit.

      malloc() returns a pointer to a bunch of virtual memory space. The actual memory pages are not allocated until you TOUCH EACH MEMORY PAGE!

      So, in linux you may as well just ignore the return values p1,p2 and p3 and just go ahead and use them. If there isn't enough memory available, the code you have at the point /* Here we do something */ will cause the application to be immediately terminated. No error codes, no way to handle it. In fact, other apps running at the same time may get terminated as well if they need to allocate memory.

      Eiffel and C++ exceptions don't help either. The c++ 'new' operator WILL NOT THROW any exception. It will not return 0. Your program will just spontaneously terminate, LATER.

      Do a search for 'Endless overcommit memory thread' in the linux kernel archives to read more about this behaviour.

      Error handling is unfortunately more complex than just handling return codes properly.

      --jeff

      --
      ipv6 is my vpn
  103. Question by C.+Mattix · · Score: 1

    I would like to see this: All /. readers add a comment to this thread. In this put the OS projects that you have worked on or are currently working on.

    Me: none......so I don't comment on things like this.

  104. /. error by xmedar · · Score: 2

    I must have been transported into a parallel universe, first a story thats negative towards Open Source on /. and then I cannot find any of the usual "Imagine a Beowolf cluster of errors", or "Is a Beowolf cluster of errors a cluster fsck?" and where oh where is "All your errors are belong to us", if anyone has directions back to my normal reality please help me.

    --
    Any sufficiently advanced man is indistinguishable from God
  105. take a look at the standards by jafac · · Score: 2

    Open Source sucks at error handling? Look at the standards in the PC industry.

    They've been declining in general for the past 10 years, and before that they sucked as well. I think the standard is really set by the hardware itself.

    Typically drive errors can have symptoms of software running more slowly as the drive retries - or applications will simply appear to hang, or if it's an error reading code into memory, well, anything goes.
    Network errors can go completely unknown until you haul out the crusty old hacker with a sniffer - oh gee, did you know that your card is dumping half it's packets?
    Oh - especially network problems - where the software at the user level 90% time just sits there and goes "Duh!" for simple things like pulling the cable out.

    Error checking and handling, in general, SUCKS and it's the main reason why computers suck - why the software industry spends billions of dollars chasing problems during the development phase that they never really get to pin down, so the problem ends up going into shipping products.

    I blame the lax standards on the platform, and the dumbing down of programming in general (the over-reliance on high-level languages that remove the programmer progressively further and further from the hardware their programs run on).

    If PC's had better standards for this sort of thing at the hardware level - and if the vendors adhered to those standards, then the software people could write software that handles errors better, and it would bubble up to the user level as more reliability, and much simpler troubleshooting, probably tens of billions of dollars saved in productivity alone, and probably the PC industry would be 10 times the size it is today, because people would actually trust them for important tasks, rather than the next nifty home killer-app like pirating music. (not meant to be a troll against MP3 trading - meant to be a troll against the apparent purpose and direction of the PC industry in general).

    --

    These are my friends, See how they glisten. See this one shine, how he smiles in the light.
  106. Exceptions don't save you much of the time. by Christopher+Thomas · · Score: 2

    If the language you are using doesn't support exceptions (C, Perl, etc), you are going to have problems. Exceptions make sure that if an error occurs, and you aren't aware of it, your program dies, and doesn't go on its merry way, causing a security hole/unstable software.

    Unless it's an uninitialized-memory error or a buffer overrun that overwrites some other program variables, in which case a C++ program will still keep going on its merry way without throwing an exception, causing difficult-to-duplicate and hard-to-trace bugs.

    If it's possible to check for the error at all, then anything that you can implement with exceptions you can implement without exceptions (though I agree that exceptions are a _neater_ way of doing it).

    If your program can't check for the error (as is common for memory errors without extensive and slow wrapping on memory accesses), then exceptions won't be triggered and you're still screwed.

    [Aside: You can propagate error codes up between levels either by making error codes bit vectors and masking subcall errors on to the parent call's failure code, or by implementing your own error stack (if you anticipate using deep recursion). Messy, so exceptions are still _preferable_, but it can still be _done_ without exceptions. Almost as cleanly, if you wrap error-handling helper functions nicely.]

  107. You can't handle the error! by tz · · Score: 1

    The biggest problem is that most errors can't really be handled. If your pointer comes back NULL, it is likely a problem outside of your control. For example, if it is because there is no memory, you can simply let it SIGSEGV, or try to put up a message - but if the library needs to do a malloc, it would likely fail within the library so you would get some other bad result.

    Or for example, a file open that fails. Maybe you don't have permission, or maybe it doesn't exist. Or maybe it is locked by someone else. Or maybe the filesystem is hosed. Most of these are unlikely events. You get instant bloatware if you now have the 1000 detailed messages explaining exactly why the file couldn't be opened. But does this improve the user experience? Maybe the most common are good (e.g. displaying the path might make a misspelled file or wrong path obvious).

    Others have pointed out the deficiencies of other OS error handling (BSOD, unhandled exception boxes, etc.), but even WHEN IT IS HANDLED, it often means the program must be aborted - it just sits there waiting for you to click OK. I find this even more irritating since I have to spend extra time fidgeting with a dialog box instead of restarting the app.

    1. Re:You can't handle the error! by Anonymous Coward · · Score: 0

      But indications are extremely helpful.

      I installed JBoss 2.4 the other day. Trying to run it with TomCat would cause a core dump, with no other messages. The problem? I didn't define JAVA_HOME when I installed Java. Gee, that was easy to diagnose (not).

  108. Re:you didn't read the article by egomaniac · · Score: 5, Insightful

    News flash: Technology pundit seemingly insults open source, Slashdot up in arms. None of them actually read the article. Story at 11.

    The article does not say "open source doesn't handle errors as well as closed source". What the article does say is "like most commercial software developers, many open source programmers are just plain lazy about proper error handling. But we're supposed to be better than that...".

    I don't see a problem with this statement. The fact is, most open-source software sucks donkey balls. Petreley is merely saying it's time to put your money where your mouth is -- if you want open source to be considered better than closed source software, it better stop being so danged flaky.

    --
    ZFS: because love is never having to say fsck
  109. since when is bad engineering unique to OSS by f00zbll · · Score: 1

    The issue isn't about OSS. It's about solid programming practices that encourages good document, thoughtful design and good exception handling.

  110. It is not the programmers, it is the projects by dsfox · · Score: 2

    Open source programmers are basically the same people as commercial programmers, maybe by night or maybe as different jobs come and go. The difference is that most open source projects arise from a person's need, and it is natural to ease up on the effort once that need is filled, i.e. once the program is good enough for your personal use.

    1. Re:It is not the programmers, it is the projects by swordgeek · · Score: 2

      Hmm. Implying that open source software will never reach the same quality or build standards as professional software.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    2. Re:It is not the programmers, it is the projects by RFC959 · · Score: 1
      Thank you, I think that needed to be said. It's not like "Closed Source Programmers" are the sons of Abel and "Open Source Programmers" are the spawn of Cain, after all; they come from pretty much the same place. I code Open Source stuff (I blush to say it, since I readily admit that I'm a lame programmer to whom 50 lines of C is a big deal. Sysadminning is my real gig.), and I always try to be careful to catch any possible errors, even the weird ones like being unable to open ".".

      I've been working with a custom module written for ATG Dynamo (large, closed-source web app server) recently, and the general quality of it stinks. If it gets a message off the queue that isn't in exactly the format it was expecting, the whole thing blows up in your face (with one of those wonderful Java stack traces). Just the other day, one of the programmers on the project chortled out loud, "Hyuk hyuk! I named that variable FOOUSANYC - I hope they never move out of New York City!" and it honest to God seemed like a big joke to him. Don't anybody tell me that the quality of closed-source code is any higher than open...

    3. Re:It is not the programmers, it is the projects by Anonymous Coward · · Score: 0

      absolutely right.. wrote my own file manager in gtk cause gmc was too slow. Once it worked well enough I quit working on it and just use it. and yeah i know the command line is really fast, but sometimes i don't wanna have to type complex execution strings out so my file association model was easier to use.

    4. Re:It is not the programmers, it is the projects by SecurityGuy · · Score: 1

      It takes more than programmers to make a quality project. In that particular example that bit of poor judgement should come out in code review and the nitwit developer told to knock it off. How about we start distributing paychecks by employee number, oh, and you don't get to know what your employee number is. You'll have to figure it out by context.

  111. Of course by Cheetah86 · · Score: 1

    Do you think commercial software handles errors better?

    Of course it does. Instead of a generic bug error popup I get a nice smooth bsod, so I know exactly when I need to restart my computer and loose all my work.

  112. Error recovery? by yerricde · · Score: 1

    a system that has been revised throughout development to have rock-solid error handling/reporting/recovery.

    What is an application supposed to do when the user presses "Save" but the OS gives error "Disk full" and the file is larger than 1.44 MB? What about fopen() failing with "Not enough memory to allocate a FILE structure"? How is code supposed to recover from that kind of error without losing data (i.e. the document the user is editing)?

    --
    Will I retire or break 10K?
    1. Re:Error recovery? by Chirs · · Score: 1

      How about:
      a) not crash
      b) alert the user, who presumably can do something about it

      Chris

    2. Re:Error recovery? by Anonymous Coward · · Score: 0

      Simple, detect it and tell the user the problem. Make the user be the one to conciously try to rectify the problem or exit the program. It is better than segfaulting because the FILE* == NULL

    3. Re:Error recovery? by ebbe11 · · Score: 1
      What is an application supposed to do when the user presses "Save" but the OS gives error "Disk full" and the file is larger than 1.44 MB? What about fopen() failing with "Not enough memory to allocate a FILE structure"? How is code supposed to recover from that kind of error without losing data (i.e. the document the user is editing)?

      It isn't because they are not program errors. The user's computer does not have adequate hardware resources for the work the user attempts to do. If a program must handle that kind of errors, we need to find a way for programs to perform hardware upgrades on the fly.

      In other words: Don't kill the messenger bearing the bad news.

      --

      My opinion? See above.
    4. Re:Error recovery? by erlando · · Score: 1
      How is code supposed to recover from that kind of error without losing data (i.e. the document the user is editing)?
      Loss of data due to external failures is not an option. Don't ever trust I/O-operations to complete successfully but trust them to fail gracefully. Your program should do the same. Plain and simple. If you can't hold on to the user's data if and when you I/O fails then it's time to take a look at the design..
      --
      Remember, there are no stupid questions. But there are a lot of inquisitive idiots.
    5. Re:Error recovery? by yerricde · · Score: 1

      Simple, detect it and tell the user the problem. Make the user be the one to conciously try to rectify the problem or exit the program.

      If you can't allocate a FILE structure, you certainly can't allocate a DIALOG_BOX structure.

      --
      Will I retire or break 10K?
    6. Re:Error recovery? by cburley · · Score: 1
      It's very simple to handle situations where a vanilla malloc fails.

      Just reserve a chunk of memory via a malloc done when the program starts. The chunk needs to be big enough to accommodate whatever combination of malloc's is needed to handle a heap-exhausted error.

      Then, when the vanilla malloc fails, call a routine that starts by freeing the reserved memory, then continues to handle the error -- put up the dialog box, save data, whatever -- and it'll have what it needs for its malloc calls.

      Regardless of the open/closed-source issue, it's wise for programmers to always consider the "exit strategy" for their code -- exit in the sense of success or failure -- and reserve, ahead of time, whatever resources are needed to implement that strategy.

      And in the case of an interactive tool such as an editor, an "exit strategy" might well include the ability to save a "journal" of changes the user made to a document, in case the document itself is too big to be saved on the storage media available.

      --
      Practice random senselessness and act kind of beautiful.
    7. Re:Error recovery? by Anonymous Coward · · Score: 0

      If the reason you can't allocate a file structure is because disk is full, you can almost certainly come up with some memory somewhere to display a message, even if it's only in a status bar. If you can't allocate the file structure because you've run out of memory AND swap AND the disk is full, and you can't free up some memory from your own program somewhere, then the user's probably screwed themselves, or something (whether it be your application, the OS, or some other application) hasn't been monitoring the resources properly.

  113. Commercial error handling by Moonshadow · · Score: 2
    Commercial apps are better?

    Well, we all know how bug-free Internet Expl...<This program has caused an illegal operation in module kernel.dll and will now be terminated>

  114. The problem with this: 1 return value. by Nindalf · · Score: 2

    One thing that really bugs me about most programming languages is that they only allow 1 return value by their most natural idiom. So you get these stupid hacks where some settings of the returned value mean errors and some are useful results, of you have to define a new named data structure just for the return value of this one function, or you end up having to mix output variables with the inputs for a function.

    This is one thing I like about Forth-style languages, where it's just as natural for a function to return multiple results as to receive multiple arguments, letting you do either:
    A B / on_error{ log_error cleanup exit }else{ use_result } return
    or
    A B / on_error{ store_exception drop_result push_unhandled_exception_errcode }else{ use_result } return
    or
    A B / drop_error use_result return

    Unlike with exceptions, the possibility of an error isn't hidden away somewhere; if you ignore it, or hand it down to reach exception handling code, you have to do so right there and then, explicitly at every step. Actually, that's a general plus: with a stack language, you have to explicitly dispose of everything, which makes it harder to ignore return values, and impossible to write programs without knowing whether a function returns anything ("What do you mean it can return an error code? I though it was void!").

    1. Re:The problem with this: 1 return value. by Anonymous Coward · · Score: 0

      You can return multiple values in perl.

      e.g.

      return 1,2,3,4;

    2. Re:The problem with this: 1 return value. by Nindalf · · Score: 1

      No, you can return 1 list in Perl. It's hardly the same thing; it's a data structure that must be unpacked to be used. For one thing, if the second member of the list is the error code, then just treating it as returning a scalar will ignore the error code without even admitting its existance.

    3. Re:The problem with this: 1 return value. by tlhf · · Score: 1

      sub dual {
      # Second output denotes error
      return("Some output", 0);
      }

      if ((my($message, $error) = dual()) && $error){
      print "Worked: $message\n";
      }else{
      print "Failed: $message\n";
      }

      Works fine for me.

  115. Sloppy programming is sloppy programming by maxxon · · Score: 1

    Sloppy programming is sloppy programming, open source or not. Most programmers are sloppy and don't do error handling carefully. I'm sure the (rather high) percentage of open source programmers that do a lousy job with error handling is comparable with the percentage of non-open source programmers that do the same. Most things suck in all walks of life.

    --
    max
  116. Agreed, death to pundits by jorbettis · · Score: 2

    Linuxworld is having issues, so I can't read the atricle, but I remember Petreley from when I used to get Inforworld Magazine.

    He's the stereotypical technology pundit. He learns just enough about technology to have an uninformed opinion about it.
    The worst thing is that we on the internet have truckloads of people like him. Every mailing list, newsgroup, web log, IRC channel, or any other group in which people or trying to get things done will have a crew of wankers spouting their opinions with no attempt to actually contribute anything useful.

    What really burns me about pundits is that they're getting paid to do what a couple million monkeys on the internet do for free.

    Take Petreley. One time, he wrote an article about how maverick programmers don't write good code. I guess I can believe that. Then he went on to say that all brilliant programmers are mavericks, and Microsoft etc all hire them so they'll write bad code and people will have to buy bug fixes. Um, right. He then finished off by claiming that he used to be an absolutely outstanding programmer and that he had to quit because he was so amazingly good that writing decent code wasn't fun for him.

    He has, to the best of my knowledge, never actually contributed anything at all even remotely useful to Free Software, or computing in general. He's even worse than Fred Langa, the guy who helped invent ethernet in 1976, then spent the rest of his career punditing, developing more and more bizarre opinions as his practical knowledge became antiquated.

    So here's a message to Petreley: Do something useful, anything. If all you have to contribute is your opinion, then go home. Free Software writers are mostly volunteers, we don't have to put up with your wanking. If you have a problem with a program, file a fucking bug report. Actually, if you're such an amazing programmer, SHOW US SOME CODE! I don't care how much Infoworld pays you, to us, your opinions are worthless. So do something useful or, I'll have to dig out my cluestick and use it bash you into a profession that benifits humanity in some conceivable way.

    --

    Jordan Bettis

    ``Wherever you go, there's another stupid sigfile quote.''
    1. Re:Agreed, death to pundits by Drizzten · · Score: 1

      One could say that the "useful" job he serves is to draw attention to something that a lot of people (it seems) think needs more attention. For reference, just read all the complaints in this thread about poor error-handling. Now that he's Media, he can't REALLY be expected to be concretely useful, right? ;)

      --

      "All mankind is at the mercy of a handful of neurotics". - Norman Douglas
    2. Re:Agreed, death to pundits by sir99 · · Score: 1

      Beautiful AND hilarious. Thank You.

      --
      The ocean parts and the meteors come down
      Laid out in amber, baby.
  117. Linus' changes to recent kernels by nanuuq · · Score: 1

    The problem is as i see it that the Open Source
    Programmers are more interested in getting something to work... this is what most of us want
    to see :) .. but when it comes to the nasty problems of how and when to handle errors or exception conditions, it is no longer fun, but tedious work and thus is left on the back burner..
    who then is willing to jump in and add error handling code to a module when the fun stuff (it is already up and running) has already been coded?

  118. Not just error handling--EVERYTHING! by swordgeek · · Score: 2

    That's right, open source software sucks at nearly everything it does![1]

    Open Source as it stands today is great at bashing together a really "neat" program which gets the job done in a specific manner. Soon enough, lots of cool little features are added in, and before long you have a 'perpetual-beta application.'

    Programming, however, requires some discipline which doesn't often get put towards OSS. Programs require good error handling (and error trapping, for that matter), usability (That means intuitive interfaces), and documentation. Oh yes, and freedom from bugs. However, these things are BORING to produce, compared to the original plan of bashing out a neat routine.

    Ironically, the only way to achieve such things in a distributed and open development model, is to have a central administrative point. Without it, large projects are just impossible. Funny, eh?

    [1]of course, so does commercial software, but in different ways)

    --

    "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    1. Re:Not just error handling--EVERYTHING! by MikeBabcock · · Score: 2

      Actually, if the people who wanted to bash out the routine would do so in a library with a proof-of-concept app to go with it, then others could pick that up and run with documenting and interfacing it.

      PS, (harps again), I'm tired of poor NULL handling in glibc.

      strcpy(NULL, "bah") segfaults instead of doing something handlable ...

      --
      - Michael T. Babcock (Yes, I blog)
    2. Re:Not just error handling--EVERYTHING! by swordgeek · · Score: 2

      But that's just it--who, without their paycheque riding on it, is going to "pick that up and run with documenting and interfacing it?" Because it's not fun, it gets left behind. That's where discipline and central organisation tend to help a project.

      --

      "People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
    3. Re:Not just error handling--EVERYTHING! by MikeBabcock · · Score: 2

      You make too many assumptions.

      There are plenty of people who prefer to write English (or their own native tongue) than code. The people who document current interfaces in the Linux kernel, for example, are often not those who wrote them. This might not be ideal, but it happens.

      Welcome to the bazaar.

      PS, I often _only_ document projects I dream up and allow those who are able to hack them together in a week to do so.

      --
      - Michael T. Babcock (Yes, I blog)
    4. Re:Not just error handling--EVERYTHING! by scrytch · · Score: 2

      strcpy(NULL, "bah") segfaults instead of doing something handlable

      You're trying to write a null pointer. That has the well-defined property of raising a SIGSEGV which can be caught and handled. What do you want it to do, fprintf(stderr, "no, I can't let you do that")?

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    5. Re:Not just error handling--EVERYTHING! by MikeBabcock · · Score: 2

      Actually, you're wrong. The reason glibc segfaults is because the C specs state that the results are 'undefined'. Personally, if they're undefined, we should return the standard error condition for these functions (return NULL) instead of segfaulting.

      I know, "if (!c) return NULL;" is a lot of code to add to a string function ...

      --
      - Michael T. Babcock (Yes, I blog)
  119. Duh... by Phleg · · Score: 0

    ...of course we suck at it. Open source doesn't have bugs, remember?

    --
    No comment.
  120. Ryan Wright is a moron... by Anonymous Coward · · Score: 0

    Ryan Wright is a moron. Intelligent people don't make blanket statements about others without at least a bit of information. Next thing you know, he'll be telling you "The world is coming to an end." just because he saw it on a sign. How the hell does he know it is ending, perhaps there was more on the paper that said the world was coming to an end, and a new one is coming, even better.

  121. Blame it on von Neumann by dha · · Score: 3, Interesting
    Inexperienced and lazy programmers are usually poor at error-handling, and it's easy to lay the blame there -- but at a deep level that misses the point.

    This is not about open-source vs closed-source programs, nor for-fun vs for-money programmers. It's about computational models such as von Neumann machines that, at their deepest roots, assume there will be no errors. That chain-of-falling-dominos style of thinking so permeates conventional programming on conventional machines that it's almost surprising that any code has any error handling at all.

    Of course it's possible to hand-pack error-handling code all around the main functional code in an application.. and of course quality designers and programmers in and out of open-source will do just that.. but viewed honestly we must admit it's an huge drag having to do so, and typically fragile to boot, because the typical underlying computational and programming models provide no help with it. Error-handling code tends to be added on later to applications just as try/catch was added on later to C++.

    Lest we think this sad state must be inevitable, let's recall that other computational models, like many neural network architectures for example, are inherently robust to low level noise and error. Then, that underlying assumption colors and shapes all the `programming' that gets built on top of it. We're to the point where trained neural networks, for all the limitations they currently have, can frequently do the right thing in the face of entirely novel and unanticipated combinations of inputs. Now that's error handling.

    The saddest part is that von Neumann knew his namesake architecture was bogus in just this way, and expressed hope that future architectures would move toward more robust approaches. Fifty years later and pretty much the future's still waiting..

    1. Re:Blame it on von Neumann by scruffy · · Score: 2
      While neural networks and the like might be robust to noise, they have the problem of doing the job imperfectly.

      Do you want your data almost sorted or sorted perfectly?

      Do you want your satellite to make the right calculations to orbit and point its attenna, or is it ok to be 1% off?

      I'm also sure the bank won't mind if its accounting software is off by 1% or so. The IRS won't mind either.

      Unfortunately, there are too many operations that we want to be exact. Even very small floating point errors can cause problems, so numerical algorithms have to written with this issue in mind.

  122. The error handling response by yerricde · · Score: 1

    /*
    The trick in writing C code that handles errors correctly is to know your
    scope. Whenever you have a constructor (such as malloc() or fopen()), try
    to put your destructor (such as free() or fclose()) in the same scope, unless
    of course you are writing a constructor or destructor for some datatype.
    */

    /*
    Sorry for the readability issues, but Slashdot does NOT like code. When
    I used my standard method header, it told me I violated "junk character".
    When I removed the asterisks from the method header, it told me I still
    violated "postercomment compression". Here, I use the preprocessor to
    compress the source before the lameness filter sees it.
    */
    #define LMNS1 malloc(SOME_NUMBER*sizeof(int))
    #define LMNS2 else rval = ENOMEM

    /* allocate_3()
    Description of method.
    Returns 0 for success or an errno code for failure.
    */
    int allocate_3(void)
    {
    int *p1;
    int rval = 0;

    p1 = LMNS1;
    if(p1)
    {
    int *p2 = LMNS1;
    if(p2)
    {
    int *p3 = LMNS1;
    if(p3)
    {
    /* Here we do something with p1, p2, p3 */
    rval = 0;
    free(p3);
    }
    LMNS2;
    free(p2) ;
    }
    LMNS2;
    free(p1) ;
    }
    LMNS2;
    return rval;
    }

    /*
    I will REMOVE your "All Your Radical Touching Base Are Already Occurred to The Lesbian Monkey Puppy" Philosophy on me if you don't eat my soy google balls, hatt-baby. Real or Malarky?
    */

    --
    Will I retire or break 10K?
    1. Re:The error handling response by TrixX · · Score: 2

      This one shows another of my points:

      the problem itself has a very linear structure, but the solution here has a lot of nesting. If i had more blocks, it would have even deeper nesting.

      If the allocation was non linear (for example, a tree or a graph), and failed in the middle, deallocation would be really a mess. You would have to exit some mix of loops/recursion in the middle, and refree all before exiting.

      If you want a better solution, see my comment about BetterC. Or use Eiffel

  123. I got your fix RIGHT HERE! by Dast · · Score: 2, Troll

    I'll be blunt. Open source programmers need to stop being so darned lazy about e rror handling. That obviously doesn't include all open source programmers. You k now who you are.

    If you want a demonstration of what I mean, start your favorite GUI-based open s ource applications from the command line of an X terminal instead of a menu or i con. In most cases this will cause the errors and warnings that the application generates to appear in the terminal window where you started it. (There are exce ptions, depending on the application or the script that launches the application .)

    Many of the applications I use on a daily basis generate anywhere from a few war nings or error messages to a few hundred. And I'm not just talking about the deb ug messages that programmers use to track what a program is doing. I mean warnin g messages about missing files, missing objects, null pointers, and worse.

    I'll be blunt, too. I got your fix RIGHT HERE! I have whipped up some open source magic that uses a powerful error-finding heuristic in combination with a correction algorithm. It should fix all of these problems you have described.

    ----CUT HERE----

    #!/bin/bash

    if [ "$#" -lt "1" ]; then
    echo "Usage:" $0 "<program> {<args>}
    exit 1
    fi

    $* 2>/dev/null
    echo "All errors corrected!"

    ----CUT HERE----

    You are not expected to understand how this works. Send me beer, we open source guys like that.

    --

    This sig is false.

  124. Follow the example of strerror() by yerricde · · Score: 2

    Error messages need to have numbers associated with them. For instance when I have ORA-1241 in oracle, a quick search in groups.google.com will give me a lot of informations about this error, and why it occured and what I can do about.

    C's strerror() uses another approach: a short 6-character name for each error ("no such file or directory" is ENOENT, etc.) that stays constant across localizations.

    The situation is even worse for people who used localised versions of the software, as you don't have the English translation

    Whether you get "Non ci è tale archivio o indice (ENOENT)" or "Es gibt keine solche Datei oder Verzeichnis (ENOENT)", you can still search on the ENOENT. (Translations by Babel Fish.)

    Now if only the popular apps did this...

    --
    Will I retire or break 10K?
  125. A core dump *is* an error message! by Anonymous Coward · · Score: 2, Funny

    A very smart guy from SGI once told me "A core
    dump is the best possible error message because
    it contains ALL the information you need to
    diagnose why the program had to stop running."

    Mmmm'K

    :-)

  126. Done better by those who do it over.... by kaladorn · · Score: 1, Insightful

    Want to improve as a programming in terms of how you handle errors? Be assigned to 7/24/365 support of your product. When it tips over, deal with the irate user. When its most minor function doesn't work, get paged out of bed at 3 am. Have it do something important with lives at stake and then just _try_ to walk away from a half-fixed problem or say SEP.

    Once you've been on this hook, you look direly askance at poorly documented code (even code you wrote three years ago), code that doesn't do required error checking, needlessly convoluted code, and code which isn't easy to read at 3 am when the live system takes a hemorrage repeatedly and someone might not get a 911 call through...

    Once you've had to put yourself in the pressure cooker some clients have to deal with, you develop either a) sympathy for their situation or b) a great desire to never ever ever hear from them again. That's a good motivation to quit or to do the damn thing right in the first place.

    Too many coders are allowed to write crap, churn it out as a release, and then not worry about support, either doing none or passing it off to some other poor bugger. If core developers got stuck supporting what they wrote and their own laziness or poor planning came back to bite them on the ass, they'd learn rather rapidly to improve their code quality and handle the errors in a robust manner the first time!

    Been there, learnt the lessons, DESIGNED the T-shirt....

    Tomb.

    --
    -- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
  127. I don't see the problem... by ffatTony · · Score: 2

    Ever use a commercial unix? I use HPUX at work and True64/Solaris at school. Of those, linux programs are the most understandable when things go awry.

    Linux is a recreation of a system that has historically been 'terse'. Can we expect it to be very different?

  128. Re:That all depends on... (slightly OT) by Anonymous Coward · · Score: 0

    Apache?! I'll grant it generally works, but it's selling point is it's price tag. The quality is fine but it has nothing special to offer, it has merely okay performance. Before Apache is useful you have to add Tomcat and that is a pain in the arse.

  129. The reasons simple by clintp · · Score: 1, Insightful
    Open Source software is developed to scratch a programmer's itch.


    Anything beyond that -- for the programmer -- is simply fluff and busywork to impress someone.

    --
    Get off my lawn.
  130. Look at the messages he's giving by Xugumad · · Score: 1

    In sequence:

    • "QToolBar::QToolBar main window cannot be 0." - Looks like a problem caused by an interface generator to me. This means that a program somewhere is just plain wrong, not that its error handling has problems.
    • "assertion `queue != NULL' failed." - Incorrect code means that an assert() test is failing.
    • "Unknown type `calendar' - Okay, not sure what these messages are indicating - probably code trying to reference some type of something, that does not exist.
    • I'm skipping the Aethera messages - they're too cryptic for even me!
    • "QTime::setHMS Invalid time -1:-1:-1.000" - Looks like an object is being initialised, but with invalid values, and those values are not being updated before the system access them.
    • Balse/Gnumeric error messages - does the author have any idea how complex code would become if every single time you accessed a file, you offered the possibility of requesting a new filename, then writing over the original pathname, and retrying until it either worked or the user gave up? Messages giving hints about how to fix the problems they indicate are good, adding a massive amount of complexity to your code is not.

    Basically, almost all the messages he mentions are indicative of broken code. It may work, but that doesn't mean it's correct by a long way, and that these problems exist is just poor workmanship on the part of the coder responsible (assuming these are all meant to be stable releases - if not, someone please shoot the writer for missing the point of alpha/beta tests.

    The remaining messages indicate minor problem - none of this has anything to do with error handling, and everything to do with testing your code properly before releasing it!

  131. What does closed source have to do with it? by debaere · · Score: 1

    It should not matter what one iota if closed source handles errors better. Its only a question of whether open source handles them as perfectly as possible.

    There is one factor of open source that seems to be over looked in the evangelism. Yes open source is subject to peer review, which is one of its primary strength. However, if no one reviews the code, the advantage is not gained. Even if the code is reviewed, if its not done by a competent programmer, false confidence in code quality could result.

    Poor code reviewed by poor programmers is a dangerous combination, open or closed.

    --

    DOS is dead, and no one cares...
    If there's a Bourne Shell, I'll see you there
  132. Yet... by gnovos · · Score: 2

    ...Amazingly, with all these errors and warnings, most of that software continues to run. Compare that with the way typical windows applications work (Crash on the first error and take out something important on your way down), that sounds like excellent error handling to me....

    Just my $0.02

    --
    "Your superior intellect is no match for our puny weapons!"
    1. Re:Yet... by doug363 · · Score: 1

      Actually, some Windows programs catch faults, including Access Violations and the like. Debuggers often report "First-chance exceptions", which means that the program stuffed something up but either had a handler or hadn't done it over and over again in the same spot. (I'm not exactly sure on the details here, but since when does that ruin a good /. post?) For example, I was doing some work with Outlook add-ins and one or two of the DLLs that it loads reported "first-chance exceptions" during normal startup. So, yes, it does happen with Windows programs, but you need a debugger (i.e. the messages are pushed under the carpet).

  133. error handling and such.... by scoobywan · · Score: 2, Informative

    I noticed that a lot of the errors he was talking about were missing files, blah blah blah. This I have had problems with in X using various managers. Here are some answers... a lot of the time missing files are do to lack of checking the required packages. Also it can have to do with the way different Window Managers handle different things. I would like to see the results of these little tests done on machines that were running every available WM. I bet most of the problems with the GUI based programs that he is reporting are due to the fact that they were written on a machine running a different WM. Just my thoughts.... if you don't like it don't read it :P.

    Later

  134. It's a serious problem. by aebrain · · Score: 2, Interesting

    Error Handling and Appropriate Technology

    This article is right on target. It's much more important for open source software to be of a higher standard than closed-source, simply because with open source, shoddiness can't be hidden and swept under the carpet (to state the bleedin obvious). If we make shoddy open-source code, then up-and-coming programmers will see it, learn from it, and treat this very ordinary code as the 'norm'. Worse, they will treat it as a target to be aimed for, and cut corners so even this low standard isn't met.

    FWIW I've worked in safety-critical areas for some 20 years. I've managed to dodge being assigned to management, and am doing neat stuff like spaceflight avionics for interest rather than chasing dollars doing yet-another-b-2-b system. The biggest problem I've found with re-educating interns is getting them to be paranoid enough. It's a matter of culture.

    Quick N Dirty is an appropriate culture for some systems.

    If you're writing throwaway code for a specific purpose (such as a simple script) then quality isn't an important issue.

    If a deadline is approaching fast, your budget is zero, your team burnt out, then damn the long-term costs, hack it so it kinda works and ship it on time. It's crap, but they only paid for less than crap, so don't worry, be happy.

    There's a major financial incentive to write high-maintenance code, both for programmers and companies. You make pennies on the initial sale, megabucks on the maintenance. What do you call a programmer who writes superb code that's maintenance-free? Unemployed.

    This is true for design and requirement analysis, as well as code.

    But... it's important to realise this is not the only way of doing things. It has it's place. But not in open source.(And there's such a thing as professional pride too, but I digress)

    If you're writing a re-useable module, you should treat all inputs as being guilty until proven innocent, always check any outputs from your area, and be honest regarding what side-effects your module has. In some languages, this is easy (e.g. Ada ), in others darn near impossible (e.g. C), but it has to be done. It's obvious that you have to do it when lives are at stake. It's less obvious when you're writing some device driver for Linux - but literally tens of billions of dollars may be riding on how well you do your job. Even if you're not getting paid for it.

    I'm not asking for the degree of robustness typically shown by safety-critical systems What? Your code failed just because half the memory was corrupted and a CPU was on fire? Unacceptable! Failure is Not an Option! but enough so that BSODs or their equivalent lead to puzzlement I've never seen one of those before!.

    --
    Zoe Brain - Rocket Scientist
  135. hey now wait a minute by aechols · · Score: 0, Flamebait

    Developers: Microsoft Programmers Stink Even More At Error Handling

    they work full time, they get a regular salary, and their best uptimes still cant beat linux's best uptimes. something's just not right.

    --
    Are you pondering what I'm pondering?
  136. Yes, $$ software probably is better at this by jmay · · Score: 2, Interesting

    I expect that it is true that commercial software does a generally better job than open source software at error handling. This is probably even measurable: run comparable software products under similar usage load, and collect the errors generated (reported or experienced by users). I haven't tried such an experiment myself.

    I don't why we (we = open source enthusiasts) should feel particularly worried about it at the moment. For most applications, the commercial alternative has a vastly larger user base than the open-source equivalent. And since these users are paying for their software, they are going to expect that there is a vendor who will respond to their concerns.

    Customer service operations are very expensive. So it is very much in the interest of the commercial vendor to reduce the error rate to the level where the load on customer service is financially tolerable (this is not the same as zero).

    Fixing obscure bugs is not the most exciting technical endeavor, and skilled engineers are more willing to do this work if you pay them...

    As I said, I don't think we should feel bad about this state of affairs. A more appropriate line of discussion would be: What can the open source community do to create an environment where a higher degree of quality is met consistently for open source software products? Are there tools that we could build that will help? Non-intrusive processes that we can impose on one another? The Perl community in particular has an effort underway to establish a consistent level of testing for all the modules that are released on CPAN. Is that a worthwhile model?

  137. Open source programmers stink. Period. by Anonymous Coward · · Score: 0

    Not just at error handling, open source programmers just flail in general. If they were any good they'd be able to find someone to pay them.

    1. Re:Open source programmers stink. Period. by sqlrob · · Score: 1

      Not necessarily. I've seen some damn good closed source stuff that had funding get yanked.

  138. design before implementation by Anonymous Coward · · Score: 0

    This may seem obvious, but a lot of developers (myself included all too often) get caught up in excitement about a new project and start coding prematurely. The project should be designed (to a level that corresponds to the scope of the project, of course) before any programming starts, including prototypes. This includes designing for error conditions.

    Finite State Machines are an excellent way to model the way an application handles error situations (in addition to others). This technique forces a developer to think about these circumstances beforehand and to think of ways to maintain well-defined behaviour.

    Of course you won't be able to find every bug and error that can occur, but thorough testing helps. Bug fixes should always be checked against the design so as not to introduce more bugs.

    Sorry if this sounds really preachy, but it does help.

  139. Error Checking and Recovery are Requirements. by blair1q · · Score: 2

    Requirements are specified in design documentation.

    Each instance of Error checking or Recovery must be specified, just as the format of each element of output or the formula for each calculation must be specified.

    Without that specification, who cares if you think the code is wrong? You can't prove it's wrong because you don't have the spec and didn't pay for its development. You bought (or five-finger GPL'ed) a license to operate the software. On an as-is basis, for every piece of software anyone posting to /. is ever likely to run.

    You want it improved? Write the Engineering Change Request specifying the improvement, and send it along with the money necessary to get it done.

    Design and validation of "bug-free" code is the most expensive software process there is. Just the paperwork on the validation process will double or triple the cost of the software. The problem is provably impossible to solve, and the best efforts on nontrivial code (and sometimes on what appears to be trivial code) end up with unresolved errors that are signed-off as calculated risks the costs of which will be borne by insurance, government, lucky avoidance of catastrophe, and the bottom line.

    --Blair
    "And it pays my bills, in spades."

  140. OH NO! OS programmers can do no wrong! by SensitiveMale · · Score: 0

    How dare he even think of critizing open source software or programmers?

  141. Not TOO much by victim · · Score: 3

    ardax makes the point above, but is only scored 1, so...

    First, about your analogies...
    If I wear out the door key to my car, the car should not burst into flames when I try to open the door.

    If my car runs out of fuel, I expect that after rectifying that little problem (and bleeding the injectors) it will be just like new. I do not expect that it will ruin my tires.

    And yes, I have kept my refrigerator outdoors. I kept it on the front porch for two months while the house was being renovated 10 years ago. It worked just fine. It is 30 years old now (Thats 15 PC generations to you young whippersnappers. Moores law says the new fridges should be 1,000,000 times colder now. :-) and I expect it to continue running indefinately. About every 5 years I put a drop of oil on the fan shaft behind the freezer to keep it from squealing. Software has a ways to go.

    About the cubase incident...
    Yes, the CD is scratched. I expect that I won't be able to re-authorize my copy of the software, but don't ruin ALL the data on my hard drive! (Its actually worse. It was my wife's laptop. You do NOT want to have to tell my wife that you just wiped out her laptop.)

    About Word...
    Destroying the on disk copy of a document before successfully writing out the new copy is just plain stupid. Particularly on a Mac where there is a special file system function to swap two files. You write the new copy under a fake name, swap it atomically (even over file severs) with the original file, then delete the fake named file (which now contains the old data). No one gets hurt in error conditions, no one can ever have bad luck timing and read a partially written file off the file sever. Life is good.

    The third case (The PSC) you don't mention, but it isn't really a case of graceful degradation. Its just an irritating bug. Honestly I'd dump the device because of the irritation, but it actually feeds card stock out of its paper tray! A rare quality in a printer.

    I suppose the more explicit point I should have made is that bad things are going to happen to software and it requires effort from the programmer to deal with it. Sometimes just a tiny bit of effort. Cubase performed so badly with a bad CD that I suspect they never tested it. They write about it in their documentation, but they probably didn't test it. The Word example is just careless programming which could have been trivially avoided if the programmers understood the platform's file system calls.

    How about the cost? I estimate that it probably doubles the engineering effort to handle the exception cases to a degree that would cover the incidents I note above. In the calculus of software development the benefits do not out way that cost.

    1. Re:Not TOO much by Ayende+Rahien · · Score: 2

      About Word on Macintosh, you are talking about a *near full* disk, right?
      There isn't enouugh *space* for a new file, it *has* to destroy the old file before writing to the disk.
      Frankly, yes, it *should* make some check that the size_of_free_space - size_of_old_file >= size_of_new_file, and inform you about it, but that isn't quite what you are talking about.

      --

      --
      Two witches watched two watches.
      Which witch watched which watch?
    2. Re:Not TOO much by renoX · · Score: 1

      >About Word...
      >Destroying the on disk copy of a document
      >before successfully writing out the new copy is
      >just plain stupid.
      []
      >You write the new copy under a fake name,
      > swap it atomically (even over file severs)
      >with the original file, then delete the fake
      >named file (which now contains the old data).

      And what happens when you're editing a file on a floppy disk?
      There is some good chance that you won't be able to have both the old and the new version of the file at the same time on the floppy disk..

      So while I agree that programs should go out of their way to make sure that you don't ever loose data, I beleive that it is VERY difficult to do it right..

  142. this is a good example by BEA6D · · Score: 1

    of those patterns that pop up everywhere that look alike.
    like bad enlgish.
    and the quality of these posts and moderations.

    Most life forms on this planet are "buggy"

    ain't it fun?

    --
    rehab, captain ahab, you're chasing the wrong fish!
  143. A programmer tip regarding error messages by mcoletti · · Score: 1
    I've gotten into the habit of doing the following in my code:

    cout << __FILE__ << ":" << __LINE__ << " foo isn't in bar\n";

    That way not only do you get an error message, you get a tip to the source file and line number where the error occured.

    Certainly it's not helpful to the end user, but it does make it easier for the obsessive-compulsive programmers to find and fix the error on their own.

    --

    MAC | A polar bear is a cartesian bear after a coordinate transform.

  144. Why so inflammatory? Why all the posturing? by walterbyrd · · Score: 1

    It is just getting so old. Why must so many commentators act like snot-nosed punks?

  145. STINK?? by Anonymous Coward · · Score: 0

    The preferred word is SUCK. 'STINK' is just a stupid pussy word.

  146. Want proper error handling? Give us the tools! by peul · · Score: 1

    Error handling sucks because it is a pain to program and test. To do it proper in most API's requires heaps of boilerplate code that will increase executable size and also needs to be tested. All those return values that need to be checked. If I know smothing went wrong in the layer bolow me, I often have no proper error message to present to the user. I'm not talking about responding to wrong user input here, if there is an error in a config file any program should and could give a proper error. It is when, as a programmer, you are not in charge of the interface when things get hard.

    Error handling is one of those areas where many programmers have to reinvent the wheel, but hey, we are open source, we can share and can do better! I would be great to have a standard error handling framework that converts from return -1 and use GetLastError to raise an exception. Set standards for error reporting to include, description, probable cause, recommended action, severity etc.

  147. read the fuzz papers by mkcmkc · · Score: 1
    For a study on the unusual *reliability* of Free Software (and Open Source?) check out the fuzz papers:

    http://slashdot.org/articles/99/01/10/173223.shtml

    --Mike

    --
    "Not an actor, but he plays one on TV."
  148. Re:That all depends on... your selection of course by bowb · · Score: 1
    Why does it seem like there are as many people in the "community" criticizing open source as there are supporting it?

    It's a backlash against the hype from not so long ago that said that closed-source software was not only technically inferior but also unethical to produce. Frankly it was pretty insulting.

  149. CcWaitForLazyWritterActivity by Anonymous Coward · · Score: 0

    I can tell you one thing I know for sure. The open source community did a very good job at writting the linux kernel.

    BTW I ran into a strange Windows 2000 kernel crash lately. According to a debugger, it crashed in a function named:

    CcWaitForLazyWritterActivity

    I don't know what it was doing in there. I am not sure if I event want to know. I can tell you that I would have chosen another name for tin function.

  150. Re:you didn't read the article by DahGhostfacedFiddlah · · Score: 1

    I don't know how you did it, but my sincere congratulations :

    The fact is, most open-source software sucks donkey balls.
    Moderation Totals: Insightful=1, Informative=1, Total=2.

  151. Re:That all depends on... your selection of course by whmac33 · · Score: 1

    So Windows will dump all the RAM to a file. So now what are you going to do with it? It's not like you can actually read it easily. In all my time working on NT I don't think I have ever resolved a crash from that. Of course I haven't developed any drivers or anything so maybe it would be useful then.

  152. sdts++ and ec++ by mcoletti · · Score: 1
    I work or have worked on the following open source projects:

    • sdts++, a C++ toolkit for reading SDTS spatial datasets.
    • ec++ a evolutionary algorithm C++ library.

    I'm also working on a temporal-spatial feature-oriented library and application suite to support USGS research. Once it's mature it'll also be released as OSS.

    --

    MAC | A polar bear is a cartesian bear after a coordinate transform.

  153. use Ada, you pathetic morons by RussP · · Score: 1

    Yes, I too am tired of the constant error messages. I bet you'd get far fewer of them if you programmed in Ada. It's specifically designed for safety-critical software, i.e., error-free software.

    C and C++ are far more error prone than Ada. One study found that Ada can cut development time in half compared to C/C++ because the programmer need not spend prodigious amounts of time tracking down segmentation faults and other such crap.

    --
    I watch Brit Hume on Fox News
  154. This guy has never used Oracle ... by dhogaza · · Score: 2

    Or else he wouldn't think that only open source software has lousy error messages...

  155. The user should not see errors unless they want to by Codifex+Maximus · · Score: 3, Insightful

    The user should not see errors unless they want to. I agree with sending errors to STDOUT. If the user wants to see the errors then they can either start the app in an XTERM so they can see the errors or switch virt terms over to VT1 and see the STDOUT output.

    Also, I use error reporting to a logfile rather than alarming the user. Most applications should be able to survive the average error. Those applications should prompt the user for proper input - even to the point of placing the cursor in the proper field. Each field should be intelligent and be able to validate it's own input data.

    Those error logs I spoke of should be used by the programmer to debug his/her application - don't alarm the user ok?

    --
    Codifex Maximus ~ In search of... a shorter sig.
  156. Re:Too specific: Programmers Stink at Error Handli by Broccolist · · Score: 2
    The last time I used Word a drive filled during a save operation and left me with just a mutilated copy of the original file. (I will not use it again.)

    Something similar but worse once happened to me. I was editing something with Word while browsing the web; not doing anything out of the ordinary. I saved the file and logged off for the day. When I tried to open it again, Word refused, claiming the file format was incorrect.

    I looked into the .doc with a hex editor and found that some HTML source had somehow found its way into the .doc! I was using win95, so I guess this can be chalked up to buggy filesystem code. The weirdest and most frustrating bug I've ever seen. I didn't manage to recover any of my work.

  157. Re:The user should not see errors unless they want by Codifex+Maximus · · Score: 2

    doh! heh make that STDERR heh :)) Must remember that Preview button.

    --
    Codifex Maximus ~ In search of... a shorter sig.
  158. Re:That all depends on... your selection of course by InsaneGeek · · Score: 2

    I don't think people are bashing the free stuff, but more along the lines of giving it the same type of scrutiny that everything else is given. Honestly if people can't take any criticism at all, you better crawl into a hole, because the *real* world is a scary place.

    There is a famous mantra, all programs suck, some more than others (I'm replacing the original word OS's with programs, cause it still fits perfectly). That goes for closed, open, free, expensive everything; all programs suck, and being able to openly talk about deficiencies in them is the only way to make them suck less. It strikes me as rather two faced complaining about "people bashing free software", when just before that *you* bashed other software, for the same legitimate reasons others supposedly "bashed" free software. Again all programs suck, being critical of them makes them suck less.

  159. Re:That all depends on... your selection of course by flink · · Score: 1

    Tell me about it. We have a service offering where each of our clients has a different virtual root under IIS 5/W2k. Right now we are at about 80 customers and at least twice a day we have to reset one virtual root or another because the IIS process crapped out and stopped responding. This is with memory protection set to high (seperate process) too.

  160. Re:Too specific: Programmers Stink at Error Handli by Anonymous Coward · · Score: 0

    Well known bug. When writing blocks out to disk, it doesn't remove the previous contents. You were probably seeing part of a cache file.

  161. Use a better metric for software quality by kelv · · Score: 1
    I would like to take issue with the manner in which the author assumes that error/warning message dumped to the console are automatically bad.

    In most cases (particulary GUI programs) there may be little things that the system can't do. Can't find an icon, a pixel map or a help file. How annoying would software be if it asked you to try and find *every* little thing that it could not find, irrespective of how insignificant to the running of the program.

    I think it is one of the great things about OSS that on the whole the developers are prepared to print a lot more error/debugging information than most closed source software as it gives you half a chance at working out what went wrong. Much better than hiding them where no one can see (as hapens with a lot of software).

    Don't get me wrong we should all be striving towards better quality software but the number of error message you print is a pretty bad metric for software quality.

    Kelv!

  162. That's exactly what Preterley said by Pseudonym · · Score: 2

    Read the article. That's exactly what he said. Here's the title and the subtitle:

    Open source programmers stink at error handling

    Commercial programmers stink at it too, but that's not the point. We should be better.
    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    1. Re:That's exactly what Preterley said by King+Of+Chat · · Score: 1

      Agreed - most programmers stink. I'm sitting here with a shedload of C++ in front of me (for a commercial program) and the line:
      catch (...) { }
      appears with a depressing frequency.

      I know the guy who did this and he's not dumb - just lazy. Even an assert in there would give you a fighting chance of finding out that something went wrong. Jeez.

      --
      This sig made only from recycled ASCII
    2. Re:That's exactly what Preterley said by malfunct · · Score: 1
      What he did sucks, asserts suck slightly less.

      He should have done something intelligent with the error message or recorded it and died.

      --

      "You can now flame me, I am full of love,"

    3. Re:That's exactly what Preterley said by sir99 · · Score: 1

      Oh wow, at first I thought you put: catch(...) {...}, but the braces are empty. Wow is that shitty

      --
      The ocean parts and the meteors come down
      Laid out in amber, baby.
    4. Re:That's exactly what Preterley said by ackthpt · · Score: 1
      catch (...) { }

      Yeah, just as bad. Lovely when they're supposed to be getting some mandatory data or resource, fail to and let the app keep going.

      --

      A feeling of having made the same mistake before: Deja Foobar
  163. Sad....but true.... by Chanc_Gorkon · · Score: 2

    I agree with Nick. Programmer Error handling sucks, but not just in Linux and Open Source. An example is at work, we had a programmer write a batch file to concatenate(sp?) two to five files together into one big file. Only thing is it depended on a network drive mapping (on a volume up on a Novell server...yech) and files to be there. If the batch file failed, there was no way to know it failed because of a network drive mapping error because bloody DOS has no frickin return codes. I WISH they'd let me and the systems programmer set these dang things up on a linux box so we could write a BASH or TCSH script with proper error checking so we could provide a return code back to the mainframe that triggers the script. That way the mainframe could holler at the operator that there's a problem. Right now, if the batch file fails it just drops thru. If it wasn't going to be replaced soon, I would rewrite the damn things, but since a new system will be entering implementation soon, we will be freezing all development except for fixing errors and fulfilling state/federal mandates. Hopefully the package we are going to (anyone ever heard of the education only package called Colleage by Datatel?.....it runs the business side as well as the scheduling, record keeping and all of the stuff a college computer system is doing....). Anyway, at least the picked the right OS and, in my opinion, the right DB for it (AIX for OS, and Oracle for DB......the other choice was....shudder....NT/2000 for OS and I believe SQL server, but it may have been something like DB/2 or something weird).

    --

    Gorkman

  164. Yes and No by Bugmaster · · Score: 0
    I think the author has a point, but it's not the point he was trying to make.

    It seems that what he really annoyed by are all the error messages scrolling by on his console. IMHO, error messages are great. For example, I just reinstalled Windoze 2000 (hey, I need my games) for the 3rd time this month, because InstallShield stopped working, and I couldn't find out why. If I could read some log file somewhere, or look at a console, and see a message "InstallShield error: file xyz.abc is missing; assertion failure in Foo.c line 12345", I could at least try and fix the error. If source code was available, you can bet I'd go to line 12345 and fix it there. Anything is better than spending another 3 hours restoring my settings from scratch.

    In addition, while that guy was looking at all the nasty error messages, his software was working (most of the time). Perhaps it was working only partially, but it was working nonetheless. This demonstrates that errors are actually handled pretty well. Of course, that pwd segfault is an embarassment, but that's another story.

    However, while commercial application software is worse at error-reporting, it is generally better at reliability. Yes, go ahead, flame me if you will, but so far I haven't found a single OSS application that worked the way I expected it to. There are always some UI bugs, rendering bugs, "don't do this or it will segfault" bugs, and so on (I am still waiting to see a default RedHat installation where all the fonts are legible in Netscape). By contrast, I can load IE, or AIM, or even Word, and be able to click any button without it crashing (figuring out what the buttons do is another story, but OSS has that problem as well). Note that I said "application", meaning user-level GUI code. Server-side OSS code, such as sshd and Apache and whatever, is generally much more reliable than its commercial counterpart.

    I am not sure why the situation above is the case, but I have a hunch that it's because OSS programmers consider UI to be passe - something for those mundane lusers to concern themselves with, not Real Programmers. Real Programmers write Apache, not word processors or UML viewers. And that's probably why Linux has lost the desktop war.

    --
    >|<*:=
  165. Assuming no errors.. by cmdean · · Score: 1
    is exactly what professional programmers do not do under any circumstances. Using complicated systems such as neural networks to try to solve unanticipated problems is IMO the wrong way to go. How do you fix the errors in the error handling system when the error system is more intricate than the original problem?

    Similarly focusing solely on error handling will not make reliable code, it is like an old fashioned assembly line with quality control at the far end of the plant. The real focus must be on writing robust code in the first place. As mentioned before that comes from good, simple program structure and design, good software engineering, and through testing.

    In short having a professional attitude to the product you produce, no matter if it is a win toy, an open source project, or a million dollar shrinkwrap system the boss wanted released yesterday, is the real solution. The rest are tools to help you achieve this professional standard, not the solution.

  166. Re:That all depends on... your selection of course by MikeFM · · Score: 2

    The author does have a point in his article. A lot of programs do spout nasty pointless error messages both at compile-time and at run-time. This is fine in development but stable versions should catch and properly handle such errors. That goes for any program regardless of the license it comes under. I think the main reason we notice it more on opensource apps is because they are public during development and a lot of times are already being included in your favorite distros. While the extra use does help the debugging process it can leave an impression of lack of polish.

    --
    At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
  167. Re:That all depends on... your selection of course by david+duncan+scott · · Score: 2

    Well, yeah, because real core dumps go to the line printer. Everybody knows that.

    --

    This next song is very sad. Please clap along. -- Robin Zander

  168. Explanation via Analogy by jayed_99 · · Score: 3, Insightful

    The main difference between a great systems administrator and a technically competent sysadmin is paranoia.

    A great sysadmin would cut out their own heart before operating without known good backups. A great sysadmin would chew their own arm off before putting something into production without testing it first in a development environment. A great sysadmin *always* has a backout plan.

    And how does a lowly admin reach this amazing level of greatness, you ask?

    Admins get paranoid after making hideous, terrible mistakes that immediately result in Bad Things Happening.

    I have personally: killed the email server for 2 days...shut down distribution for the world's largest distributor of widgets (every Thursday for 3 weeks)...destroyed all connectivity (voice and data) to the world for 12 hours...hosed the upgrade on a 700GB Oracle database (and our backups were no good). And any semi-experienced administrator will have, at minimum, two stories that are at least this bad (like my friend who shut down trading at Fidelity for a day).

    And for every one one of these instances, I immediately felt the wrath of: my manager, my manager's manager, other people's managers, other people who were affected, stray people wandering by my cube who weren't affected...I also became a part of the "mythical sysadmin storybook"--"I once worked with this guy, and (you won't believe this) he..."

    I submit the hypothesis that: generally, most developers are not subject to this type of immediate and extremely negative form of feedback for their mistakes. Therefore it takes a developer a long time to develop an aversion reflex that conditions them to do "the right thing -- error handling, code documentation" instead of doing "the easy, interesting, enjoyable and sexy thing -- making spiffy algorithms, writing tight code".

    Drifting into another analogy, error handling is like code docmentation. Why do most developers get good (and a little obsessive) about documenting code? Becuase they finally spent some years trying to maintain someone else's tight, sexy code that is virtually incomprehensible.

    So, my point is, developers take a long time to viscerally learn the need for good error handling by repeatedly getting whacked on the head for lack of error handling. It's like evolution in action.

    1. Re:Explanation via Analogy by Anonymous Coward · · Score: 0

      I have personally: killed the email server for 2 days...shut down distribution for the world's largest distributor of widgets (every Thursday for 3 weeks)...destroyed all connectivity (voice and data) to the world for 12 hours...hosed the upgrade on a 700GB Oracle database (and our backups were no good). And any semi-experienced administrator will have, at minimum, two stories that are at least this bad (like my friend who shut down trading at Fidelity for a day).

      Hmm.. worst thing I ever did was this (while installing a new HD in our fileserver - our tape drive had died, and the powers that be decided to do backups to a second drive instead.. so we had no backup!):

      # mke2fs /dev/sda

      instead of

      # mke2fs /dev/sdb1

      (brainfart - I was thinking first partition on second disk, when my fingers were thinking first disk :o)

      I realized what had happened, and killed it before it had overwritten our accounting data (thank god for my habit of putting my swap file at the beginning of the drive!) but it took a couple of hours to extract the data and rebuild the system :o)

      Things I learned:

      Always do major system maintenance at the beginning of the day, instead of the end, and when installing a new drive, CHMOD the /dev files for it (and only it) to an unpriveliged user, then fdisk/format it as that user.

    2. Re:Explanation via Analogy by jmcmurry · · Score: 1

      The best teacher in the world is scar tissue.

  169. Yes, they DO suck at bug tracking/fixes by sudog · · Score: 1

    They'll only fix or redesign those items that they are motivated to fix. For most of them, the niggling problems that the rest of their user population think are really obnoxious really aren't as important as hacking in that "new feature" they've been thinking about for the past three or four weeks.

    After all, they're not making money off the software, and they're quite happy to let their users do the work on their own (and accept the patches.)

    Commercial houses have extensive bug-tracking software--and, based on user pressure, fix those bugs on a regular, and timely basis. Else they lose their customers to someone else who does. (Exception: Microsoft.) They expend vast resources to track these issues (using TeamTrack, DevTrack, or something (yuck) from Rational). And their developers are usually paid specifically to cater to their larger or more influential customers--ie: fix the damn bugs or change the behaviour.

    *shrug* Simple question of motivation. Self-motivation is notoriously less reliable than employment-motivation. :) IMHO..

  170. Another solution by KnightStalker · · Score: 2

    This will probably annoy programmers who started with "pure" C++, Java, or VB.

    int allocate_3(void){
    int *buf, *p1, *p2, *p3 ;

    buf = malloc(3*SOME_NUMBER*sizeof(int)) ;
    if (!buf) { return -1; }

    p1 = buf ;
    p2 = buf + SOME_NUMBER;
    p3 = buf + SOME_NUMBER*2 ;

    /* Here we do something with p1, p2, p3 */

    free ( buf ) ;
    return 0 ;
    }

    --
    * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
  171. Commercial Vendors' Secret by Coward+Anonymous · · Score: 1

    Behind most commercial successes you will find a QA team. Unfortunately, the larger the QA team, the crappier the underlying code.
    Commercial vendors can hide crappy code because they have large and organized QA teams to uncover bugs.
    The OSS community might have a lot of testers but they are not nearly as efficient as a dedicated QA team.

  172. Killed accting server during merger & yearend by glrotate · · Score: 1

    You are absolutly correct. Major Ass Reaming -> Paranoia -> Extremly Careful Admin.

    I think you are also absolutly correct that the lack of this direct conditioning with programmers causes them to make the same lazy mistakes that make the admins paranoid.

  173. Cathedral and Bazarre anyone? by Anonymous Coward · · Score: 0

    May I suggest reading ESR's "The Cathedral and the Bazarre"!? In it, he talks specifically about how the OS community releases projects, and improves them over time.

    Remember, in many cases, OS projects don't specific people testing their software, rather they rely on the feedback from users outside the project.

  174. Oh please! by Anonymous Coward · · Score: 0

    Error handling? Thats easy!

    main ()
    {
    system ("chmod +x readme");
    system ("./readme 2>/dev/null");
    system ("chmod -x readme");
    }

    No one ever reads the readme anyway... So its the perfect solution!

    I wonder if they'll ever figure out why my code appears to be so small?

  175. Just say no... by j3110 · · Score: 2, Interesting

    to bugs. Bugless programs don't need error checking, just input bounds checking. Use Lisp and prove your program with mathmatical induction, or optionally, you can keep the same mindset in C. Just don't let the user screw up. If you have a finite set of inputs, you can very easily see that your program won't fail. I find it much easier to create functions to test that certain things work as expected than putting try blocks around things.

    Now that I've given all the tips that I'm aware of, its time for the justification of my own faulty behavior that can't be justified :)

    I think open source software does well for bug handling though. The bigest things I can think of that a lot of open source projects have faults with were never meant to be mission critical || are v1.0 || miss coordination caused some negative synergey. As for the first two, you should expect failures. The last is going to happen to even the best. I think it is a testament to OSS still. With such little time to invest, all the products I've seen get better every day.

    And here come the excuses... :)

    I really wouldn't call it laziness, but more a lack of motivation. The bulk of OSS is written in a geeks spare time, which in itself is small if the geek attends college and works. You have to account for all the reading a geek has to do on a daily basis. (Slashdot, Freshmeat, Changelogs, Anandtech et al, Pricewatch & EBay) Then account for all the time A geek spends perfecting his own system. (New kernel, apt-get, compiling his special favorite programs(MySQL, Apache, PostgreSQL, XBill)) By the time you get done with all the things you try to stay on top, you really don't have much time left. From there on out, your sleepy and are working purely on caffiene. You will enevitably make a few mistakes. :) It's not laziness... just tired, and you aren't really getting paid for the work, so why try as hard as you do for paid work? I'm not even metioning games which I believe are essential. All programmers need to take their frustrations out on some helpless AI creature, or else they would buckle under the stress.

    Before someone says it, I know the rewards of OSS programming. If there were no rewards, then no one would do it in the first place.

    --
    Karma Clown
  176. Something to be said for baby-sitting mainframes by dinotrac · · Score: 3, Interesting

    I'm astonished at the poor error-handling in most software these days.

    The biggest problem is not whether your language has exceptions (good error-handling has been done for years without them) or whether programmers are lazy. It's a matter of making it a priority. In fact, laziness caused a lot of us old-timers to take a major interest in error-handling.

    Picture the days before internet access, running mainframe systems, probably with overnight batch cycles.

    Good error handling might mean that you don't get a phone call at 3:00 am.
    If that phone call comes, good error messages might mean that you can diagnose the problem over the phone and walk the operator through recovery.
    In either case, you don't have to drive down to the data center.

    Sleep. Now there's a motivator.

  177. Microsoft apps by BlueLightning · · Score: 1

    "Unexpected error, quitting."

    What the hell is that supposed to mean?

  178. Re:HEY EGG TROLL!! by Anonymous Coward · · Score: 0

    Yeah Turd, take you -1 like a man!

  179. Not a competition by Dwonis · · Score: 2
    Do you think commercial software handles errors better?

    Dammit! This isn't a bloody pissing match! If we're going to set the bar so low that "it's okay as long as it's a little better than closed source", then we're destined for failure.

    Instead, why don't we take this criticism at face value? "Open source programmers stink at error handling." Fine. Let's start disciplining ourselves and write our code with meticulous care. After all, we have no deadlines, we don't need to cut corners, we collectively have more time on our hands, so why coudln't we write excellent code if we trained ourselves to be careful. I think it's possible.

  180. Re:use Ada by aebrain · · Score: 1

    OK, you're right. No need to be obnoxious about it though.

    Yes, they're "pathetic" inasmuch as they are to be pitied, not blamed. Sort of like someone trying to compute the 90th digit of Pi using an abacus as opposed to a PC. Morons they're most decidedly NOT. Stuff that even an average programmer can do easily in Ada, such as multitasking, template instantiation and so on require near-genius IQs to do in other languages to get half the reliability. Making a reliable Ada-95 60 task program using GNAT and Booch components (cost : $0 ) is not trivial, but any good intern should be able to do it. But just try porting a simple 60-thread program using STL constructs in C++ from Linux(gcc) to Mac OS8(code warrior), or even Windows 95(VC++ 5) to see what I mean. They have to use all sorts of operating-system specific stuff and ifdefs rather than write once, run-anywhere code. And do surgery on the different variations of the STL.

    What's more, "everyone knows" Ada's too verbose, and is to be eschewed because it has lots of reserved words (not as many C++ or Java), and has weird, untested and Evil features such as Exceptions and Generics. It got a bad press for this in 1983. So don't blame them, nor disrespect their intelligence.

    It's difficult to go over bounds checks and disorder parameters when all you have to do is write code like

    begin
    1. for this_reg in hardware_defn.IO_Registers loop
      1. read_and_store_value ( register => this_reg, at_time => calendar.clock );
      end loop;
    exception
    1. when timeout_error => check_connection;

    2. when others => raise;
    end;

    Try writing the same thing in C++ without leaving yourself open to lots of changes if the register enumeration changes from 0..5 to 67..76 or even (34, 45, 78) or (back, top, aux) and you'll see what I mean. Writing quality, efficient, readable code that handles errors well in some languages is just plain hard. So don't call them morons, they're just handicapped by using the fashionable and popular because they don't know any better. Even though there's plenty of evidence.

    --
    Zoe Brain - Rocket Scientist
  181. C HAS exceptions. by epeus · · Score: 2

    Exceptions are mandatory for good programming, period. If the language you are using doesn't support exceptions (C, Perl, etc), you are going to have problems. Exceptions make sure that if an error occurs, and you aren't aware of it, your program dies, and doesn't go on its merry way, causing a security hole/unstable software.

    C++ is implemented in C. Get out your copy of K&R and look up setjmp and longjmp. Do they sound scary? They should.
    That is how C++ exceptions work too. Throwing an exception wihtout catching it is calling longjmp without setjmp.

    It is your job as a programmer to check error return values, and write you code to clean up after itself if an error is returned. Throwing an exception is a cop out from cleaning up properly.

    If your app aborts when memory or disk space is low, you could lose hours of work for your user. This is not going to make the user think your app is stable.

  182. Re:In a word? -- NO! by shampster · · Score: 0

    Due to the nature of 'Open Source', end-users will likely be using the software long before a commercial company would release it. Open Source software is meant to be shared (even at it's most alpha stages). I think that most 'open source' coders put function above form, and features above stability. As coders become satisfied with their implemented feature-set -- they will go back and improve documentation/stability/correctness. A good example of this IMHO is rsync.

    --
    aXV1cTswMDR5dS9wc2gwYnFxew
  183. Re:you didn't read the article by Malcontent · · Score: 2

    This is slashdot any post critizing linux or open source get modded up. Where have you been?

    --

    War is necrophilia.

  184. That IS what error codes are for. by epeus · · Score: 2

    The problem with result codes is that you can't propagate the problem up to the level of scope that should be dealing with it. For example, imagine you have a GUI program. At some point, it needs to open "foo.txt", but fails. Since you're a good software engineer, you've well-separated your GUI code from logic code. The GUI needs to display an error message, but if you only check error calls, the only part that knows about the eror that has happened is way down in the logic code, which has no idea how to tell the user. And propagating 'undef's all the way up through the code is uncool. Especially since return values should not be used to indidate errors; they should be used for return values.

    That last sentence is stupid dogma. Take a look at the Mac OS APIs sometime. Almost all routines return an error value, of type OSErr. 0 means noErr, negative error values are well-defined by the OS. Postive errors above a certian range are left for applications to use.

    With this convention, an error can be passed up the chain, and interpreted or transformed at each stage into something meaningful for the stage above.

    At the GUI level, you can map error codes to strings based on these well-known values.

    1. Re:That IS what error codes are for. by Anonymous Coward · · Score: 0

      Considering that Macs are infamous for wonderful error messages such as "An Error of type -N Occurred", that example didn't help your argument all that much.

  185. My favorite MS error messages. by Malcontent · · Score: 2

    "When was the last time Windows gave you a nice error.log when it blue-screened, or how about IIS on a buffer overflow?"

    First of all logging in windows pretty much sucks ass no matter what you are dealing with. I suspect this due to sever lack of any decent text tools like awk, grep, tail etc. Windows admins would get too confused with utilities like that.

    That aside here are my favorite error messages I deal with pretty routinely.

    From Access "there is no message for this error". Oh yea that's real helpful.
    When importing data into SQL server "Overflow". No mention of line numbers or data types or field names. All you know is the one line of thousands had some data that SQL server did not like. Good luck finding it. What I do here is to create the same structure in postgres and import it into there. Postgres tells me what line and what data is bad. Postgres is a great debugging tool for SQL server and in many ways much better database.

    And in ASP pages sometimes it pukes with a number (no message) a search on this number on the MS web site reveals that the error message means "exception occured". Wow that's real helful huh? A search on google shows many people with this problems with nobody giving solutions. My answer? Re-do the page in php.

    --

    War is necrophilia.

    1. Re:My favorite MS error messages. by Anonymous Coward · · Score: 0

      You think you've got problems. How about:

      There is not enough memory to complete the

      under high load, and I have screenshots of:

      Drive C does not exist

      when looking at c:\...(x^n subdirectories)

    2. Re:My favorite MS error messages. by Anonymous Coward · · Score: 0

      And in ASP pages sometimes it pukes with a number (no message) a search on this number on the MS web site reveals that the error message means "exception occured". Wow that's real helful huh? A search on google shows many people with this problems with nobody giving solutions. My answer? Re-do the page in php.

      I find that those types of messages from ASP usually mean that the browser is configured for 'simple error messages' or something similar, and that disabling the option gives the line number where the error occured, and sometimes more information. Or, heaven forbid, you do some error handling of your own in your page.

    3. Re:My favorite MS error messages. by Anonymous Coward · · Score: 0

      Sometimes when I open Explorer to go surfing the disk drive, I'll get the error:

      Please insert a disk in drive \Device\Harddisk0

      Um... OK... I have to cancel two of these before I go on about my work.

    4. Re:My favorite MS error messages. by Malcontent · · Score: 2

      Not this particular error. I checked it's a mystery error whose error message is really "exception occured". Nobody seems to know why it happens or how to fix it. I wish I had the number handy but it's at work.

      --

      War is necrophilia.

  186. RTFA by Anonymous Coward · · Score: 0

    Everybody is whinning about commercial soft being as bad (or worse) than open source soft. Now look at the FIRST line of the article:

    Commercial programmers stink at it too, but that's not the point. We should be better.

    Now please remove all your comments, and start saying something interesting. Thank you.

  187. Its not detecting the errors, its handling them. by Convergence · · Score: 2

    Its usually pretty easy to detect errors like this, for example, the program dies with a SEGV. The trick with errors is not in detecting the error, but rather in figuring out what to do when you detect it.

    Is this error correctable, ignorable, or fatal.

    If it is correctable, what is the correct action that corrects it. This can be more subtle than you think. And this correction code adds complexity and needs to be tested.

    Which errors are minor and ignorable? IE, that are actually conditional status messages not actual errors?

    What to do in a fatal error? What is the definition of a fatal error? A lot of code does not deal with resource starvation and treats running out of RAM as a fatal error. Should it? It doesn't have to, but htat would make the program orders of magnitude more complicated, it would turn every allocation into a potential exception-causing step.

    By avoiding these problems and making more things into fatal errors, we make software cheaper and more plentiful. Would you rather have a netscape that crashes a couple times a month, or no netscape at all?

    To respond to the article, IMHO, I'd treat the complaints that those applications print out as being debugging notifications. The computer warning about possible situations that might cause problems. By the same token, that code may not be robust, but making it robust introduces complexity and thus more risk for errors.

  188. Apples and Oranges by jurgen · · Score: 2, Insightful

    Without even having read the article (but I've read some of his previous stuff) I'm sure that Petrelly didn't base his statements on actually looking at code. No doubt he has some examples of errors that are no handled from the user perspective.

    But that has nothing to do with the programmers. The difference between Open Source and commercial software here is simply that companies can afford dedicated testing staff... QA departments. Most of the errors that an idiot like Petrelly will be able to find will be caught by the QA department before release. Unfunded Open Source projects can't afford that kind of QA... and with time, widely used Open Source packages tend to become higher quality than much proprietary commercial software (the thousand eyeballs effect). But early releases do tend to have errors that a QA department at a company would have caught before release. That has nothing to do with the quality of the programming.

  189. /. readers can't read. by ndogg · · Score: 1

    It amazes me that a lot of the /. readers don't even bother to just scan the article.

    "But comercial developers don't do error handling very well either!"

    If you even just scanned the damn article, you would notice that one of the first few things that Nick says is more or less that. His point is that OSS programmers should be better than them at it.

    --
    // file: mice.h
    #include "frickin_lasers.h"
  190. Re:That all depends on... your selection of course by malfunct · · Score: 2
    How many of those users are using an IISAPI module of some sort? How many of those are written well?

    Not to absolve IIS of blame, but when you run a .dll in proc and it hangs, the whole process hangs and there isn't much that IIS can do about it.

    In my experience thats where I get most of the errors with IIS hanging.

    --

    "You can now flame me, I am full of love,"

  191. Screw this by Tha_Zanthrax · · Score: 1

    Just because you don't see any errors you asume that they aren't handled all that well ?!
    They just aren't there !!
    That is (yet another reason) why Linux is a great OS

    I hate that 'Warning: You farted or your mouse moved, are you sure ? - Yes/No/Cancel'-Windows-crap.

  192. Re:Killed accting server during merger & yeare by malfunct · · Score: 1
    This is why structured peer code reviews are good. Flame the dev for every stupid thing he did in his code. He will either flake out and quit coding for you (you don't need devs like that anyways) or he will learn his lessons and write better code.

    OSS thinks that it has peer review like this because its open, but unfortunately the code is never read in a structured fashion with the comments getting back to the author with a little pain.

    I think that along with the structure test plans that were recommended for OSS there should also be a recomendation for peer code reviews. Hell with all the people that participate in a project you should be able to review the code, its not like you have half the people you need to finish the project by your insane deadline placed by marketing or anything.

    --

    "You can now flame me, I am full of love,"

  193. Re: MY PLUG sourceforge.net/projects/logw3c/ by Anonymous Coward · · Score: 0

    Ok talking about Apache, here we have
    a module to log in proper W3c format, and not that
    unexpandable "NCSA Extended" format thats been
    dragging around for ever....

    NOTE TO APACHE:
    hint , use this in your tree.

    It will make everyones lives easier.

  194. Re: ok try this buggy command then... by Anonymous Coward · · Score: 0

    netstat -c

    leave it for 1 week

    watch it use more than 50gig of ram.

  195. Rubbish, that would be like saying... by yatest5 · · Score: 1

    all MS programmers are crap.

    Wait, hold on a minute...

    --
    • Mod parent up! [a] by Anonymous Coward (Score:5) Thurs, June 31, @13:37
  196. Re:That all depends on... your selection of course by Anonymous Coward · · Score: 0

    Hey -- what are you bitching about? Under IIS4, reseting a virutal root would usually fail halfway, and you'd have to reboot the box. Damn kids don't know how good they got it...

  197. Apache only useful with Tomcat ? by Dwain_Snyders · · Score: 1

    Only for Java programmers. There are plently of other languages out there that have the same functionality and are generally easier to work with. Python, PHP, Perl (ok, maybe not PERL, but some people prefer it), Zope, CFML, and I'm sure there are tons more that I've missed.

    The point is, why are you championing Java by saying that Apache is ONLY useful with Tomcat ? Sure, it might be useful to you if you're a Java-head, but unless you'd like to point out some actual documented facts that prove Java to be better than any of these other languages, then I suggest you take back that rather biased statement :) !!

    On the other hand, if I did have to write something in Java, I'm sure it would be great. If it was indeed a terrible program, I would blame my own programming technique, not the language or platform I was using - the mantra of: "A bad workman blames his tools", is extremely apt in the world of modern programming languages.

    --

    2DUP * ;

  198. Be very careful what you publish by Lowther · · Score: 1

    Sir,

    I write on behalf of my client, the Microsoft Corporation.

    Firstly, you will be aware that the Microsoft Corporation only releases its source code to partners who have signed a non-disclosure agreement. Secondly, the code you have published on the satirical "Slashdot" web-site infringes US Patent number 666-666-666, where we protected the intellectual property (over 5000 man years) embodied in the following error trapping routine:

    main( arguments ){
    try{
    --code goes here--
    }catch( exception ){
    exec(blue_screen_of_death)
    }}

    In the first instance, our client is concerned about a possible breach of a non-disclosure agreement. In the second instance, we must insist on behalf of the Microsoft Corporation that you cease and desist from using their patened programming constructs in your software, now and in the future, and that you should remove all such error trapping from any code you have already written.

    --
    Stephen Hawking has written another book. It's about time as well.
  199. Re:That all depends on... your selection of course by Anonymous Coward · · Score: 0

    When was the last time Windows gave you a nice error.log when it blue-screened,

    DrWtsn32 creates a log-file containing symbol table, thread contexts and crash-dump file ("core"). What more do you want?

  200. My favourite crApple error messages. by flegged · · Score: 1

    An Apple haiku.

    Sorry, a system
    error occurred. Error type
    seventeen. Restart.

    What I hate about Apple software is it is so patronising. They tell you that nothing could possibly go wrong (it 'just works'), and when it does break, it gives you no clue.

    Another good one is:

    The application %s has unexpectedly quit. You should save your work in open applications and restart your computer.

    What, like you could have expected the app to die? And why the hell should I have to reboot, after an application dies? Thank Jobs for no memory protection.

    OSX isn't much better. The Window Server dies frequently, so you can't actually do anything. When I close Mozilla (selecting Quit from the File menu), it says

    The application %s has unexpectedly quit. The system and other applications have not been affected.

    So I quit an app, and OSX doesn't expect the app to quit? How about this one

    Logout has timed out because an application is not responding

    So? Kill the damn thing - don't hang around with me still logged on, where anyone can use my account!

    And something I see way too often in the OSX Console

    Looks like we missed a MouseUp event somewhere

    How the hell can you 'miss' an event like that?

    Apple software sucks at error handling. 'It just works' translates from marketese to 'just this side of broken'.

    --

    "I think he was truly surprised at how little I cared about how big a market the Mac had" - Linus on Jobs
  201. Re: ok try this buggy command then... by flegged · · Score: 1

    OSX>open TextEdit
    OSX>top

    watch as every single Carbon app takes (at minimum) 50Mb.

    OSX>open random classic app

    watch as the 'classic' environment takes over 1G of ram.

    --

    "I think he was truly surprised at how little I cared about how big a market the Mac had" - Linus on Jobs
  202. Re: ok try this buggy command then... by Anonymous Coward · · Score: 0


    top reports memory including shared and mapped. Shared and mapped. Shared shared shared. Mapped mapped mapped. Not all of that goes to a single process.

  203. Re: ok try this buggy command then... by Anonymous Coward · · Score: 0

    That's a memory leak, not an error. Memory leaks don't have to be "handled". In fact, what causes memory leaks is not handling things, e.g. not calling free() when you should.

  204. Checking pointers - or good design by codemonkey_uk · · Score: 2

    Endless checking of pointers is pointless, and wastes CPU. A much better approach is to use good design. Simple idioms such as Resource
    Acquisition Is Initialisation (RAII) are much more reliable than manual pointer checks.

    --

    Thad

    1. Re:Checking pointers - or good design by mr3038 · · Score: 1
      Simple idioms such as Resource Acquisition Is Initialisation (RAII) are much more reliable than manual pointer checks.

      ... but only if your programming language is capable on enforcing them. Most OSS projects use C so programmers have to check pointers - at least in the debug builds of libraries.

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
    2. Re:Checking pointers - or good design by rpk · · Score: 1

      ... but only if your programming language is capable on enforcing them. Most OSS projects use C so programmers have to check pointers - at least in the debug builds of libraries.

      Bingo ! Having exceptions in a language really forces the issue of error handling. It was kind of shock for me, somebody who does commercial software, to see how OSS software is done in plain old C. I have been pretty insulated from that, having used mostly C++, Java, and Common Lisp, all of which support and use exceptions. Returned status codes and null pointers are just too easy to ignore. The other problem with C (if not Basic or Perl) is that early returns that you might want to make in error situations become tricky because you might have to let go of things that that you allocated earlier in the function.


      I am working on a project now that does involve wrapping an old C library, and every single use of the old API is wrapped in a macro that will throw an exception on a bad return.

  205. drawing all over one line by n · · Score: 1

    as soon as the source is opened, all error handling suddenly dissappears

  206. Open Source Error Handling *DOES* stink... by maroberts · · Score: 2, Interesting

    ...but the same is equally true of the vast majority fo commercial and closed source programs too. The sad fact is that jobs like reducing the number of warnings from the compiler and testing can be incredibly boring jobs that noone wants to do, so NoOne does it except in the most perfunctory manner.

    Its been said that a lot of open source development projects ought to have some form of Audit person or team whose job it is to look at the project code and then when they find problems to go and reeducate the person who wrote the faulty code, preferably teaching him not to do it again [with a large hammer if necessary!]

    --

    Donte Alistair Anderson Roberts - hi son!
    Karma: Chameleon

  207. most developers stink at error handling by mj6798 · · Score: 2

    Open source is hardly alone in this. Commercial software may detect errors with greater regularity, but it, too, rarely does the right thing when it actually finds an error (a dialog box is not usually the right thing). Languages also often do the wrong thing: C has no exception handling or automatic cleanup, Java encourages programmers to handle exceptions poorly, and only very few languages have restartable operations. I think to address this, we need a lot more training and education, but what else is new.

  208. Speaking of Neural Networks ... by Aceticon · · Score: 2

    I once implemented a Neural Network for a school project (from the bottom up in C++).

    The thing was trained to recognize numbers, but we never got a success ratio bigger than 85%.

    Suposedly we should've manage to get more than 90%, but there was a programming error in the code for the NN implementation.

    The interesting thing is that the Neural Network actually adjusted to compensate for a bug in itself and achieved an 85% success ratio ...

    Now that's error handling

  209. Displaying non-GUI errors in GUI by jimm · · Score: 1

    I write layered code. The domain objects know nothing about the GUI. The problem is, when something goes wrong deep in the bowels of the code, how do I get the error to the user?

    Throwing and catching exceptions doesn't seem like the right way, but that's often what I end up doing.

    What do you do?

    --
    Transcript show: self sigs atRandom.
    1. Re:Displaying non-GUI errors in GUI by pkesel · · Score: 1

      When you're writing in layers you have to design the interface between layers. The frequent benefit to designing software in layers is to provide abstraction, allowing the substitution of one layer with an upgrade or alternative. If you've not designed good layer interfaces that indeed keep the layers separate, you've likely failed to achieve that objective.

      You can have any number of interface mechanisms. One application I wrote had a message queue that one layer wrote to and another read from. It had a secondary preemtive queue into which high priority messages were written that would control the reading from the other queue.

      If your layers are actual processes you can use a pipe and any number of messaging options. If you're writing in Unix land with C++ and your layers are threads, you can write the signal handler to cause specific actions in particular threads.

      In Java you can make your own event notification listeners. Classes implement an EventListener interface that you design yourself. They register with a static EventDispatcher thread. The lower layer can implement an EventProducer interface, which also registers with the event dispatcher. When it has an error you can post the event. All listeners for that event type take the appropriate action.

      The key is defining the interface, and making sure that the interface is a clean break between the layers.

      --
      - Sig this!
  210. Re:Killed accting server during merger & yeare by budgenator · · Score: 2

    Try explaining the code to the receptionist at you Dentist's office, can you do it? if not maybe you don't realy understand it your self. Many problems in personal programming projects of mine were solved by explaining it to my wife. People like these tend to ask stupid questions, which generaly point out your stupid assumptions.

    If the code is too hard to explain, its probably too complicated. If its too complicated its probably slow and buggy to. One thing I hate is a lot of OSS projects require certain libraries that are un available. After developement it helps to test them on a plain vanilla distro w/o a bunch of develoment libs just to see if they still work and if the required libs can be installed without breaking the rest of the system.

    --
    Apocalypse Cancelled, Sorry, No Ticket Refunds
  211. if the program doesn't crash and burn, by budgenator · · Score: 2

    you should at least be able to hit cancel, cleanout a couple 100Mb of GoatPorn and resave with out lossing anything except your patience.
    If the program crashes, losses all of your work and corrupts the OS, at least others can use your program as an bad example.Actualy I remember when a 1.44 MB floppy was big and fast compared to a 1500 baud cassette tape for storage.

    --
    Apocalypse Cancelled, Sorry, No Ticket Refunds
  212. What? The opposite is true in my experience by benb · · Score: 1

    I always counted the error handling as big advantage for open-source.

    In commercial GUI apps, you usually get an error with the content of approximately "Sorry, something went wrong. Please see our Help" - the last word points to a completely generic and useless help or web page.

    RealPlayer is especially bad. Just about every error I ever got was the above error dialog, and the webpage told me that 'this is an infrequent error, for which there is no description. Please excuse.' Interestingly, those "infrequent errors" included a non-reachable Internet.

    I guess that commercial programmers want to "save" users from the messy details (forgetting that the user has to care about them anyway, because he has to fix them) or just have "no time" (but prefer to add features).

    With open-source, you have to look harder for error msgs (usually in /var/log/something -
    grep appname /var/log/*
    helps a lot), but those that you get usually point you very precisely to the problem, which makes fixing the problem *a lot* easier.

    Of course, a program being open-source (or a programmer using those licenses) doesn't automatically give it such attributes like good error handling. There are good and bad apps in each "league".

    Error handling (and proper reporting of them to the user) might be dry to program, but saves the user countless hours of hair-tearing - regardless, if expericed or novice users.

  213. Von Neumann ref. by Blackheart2 · · Score: 1

    The saddest part is that von Neumann knew his namesake architecture was bogus in just this way, and expressed hope that future architectures would move toward more robust approaches.

    Please provide a reference for this.

    --

    BH
    Fools! They laughed at me at the Sorbonne...!

  214. Get a life by budgenator · · Score: 2

    1 I want to Work not run exotic diagnostic programs on other peoples software.

    2 I concidered the disk writing dialog disapearing after the program finished writting to the Disk buffer but before the floppy was written to, to be the first indication that Windows 95® had a problem.

    This is exactly the kind of thing that the topic is talking about error and exception handling, if you can't anticipate a common user error and make your software robust enough to handle it, then your reputation is going to suffer.

    --
    Apocalypse Cancelled, Sorry, No Ticket Refunds
  215. who cares how commercial progs are?! by Anonymous Coward · · Score: 0

    point was: error handling stinks. it's a bad excuse to point at commercial or closed source programs and say: "hey, their error handling stinks too!"

  216. Error messages in commercial apps by 10100101 · · Score: 0

    The only reason AbiWord didn't output errors is because it's programmed to only output them in debug mode. Gnome/gtk and other OS apps are programmed to always output them.

  217. Error Handling by Anonymous Coward · · Score: 0

    Anybody who does this for a living will tell you that a great deal of the time and effort involved in commercial software development is in error handling. Dirty, grungy, low-visibility, but important work. Its one thing to make a piece of SW work; it's another to make it recover from "unexpected situations" (i.e., no disk, disk error, network problem, wrong file structure, etc).

  218. Experience is good, but... by kawika · · Score: 1

    Each new project will have completely new ways of failing in addition to the old ones (full disk, unplugged cables, etc.). Testing will help find those but if you think you'll find most you're in denial. Take your own moderately complex piece of code, cross it with dozens of other complex pieces of code and operating system versions, then give it wide distribution across the Internet. Now you've got thousands of permutations and interactions that were never imagined by the designers and programmers.

    You'll never eliminate the errors in the field, and thinking that you can eliminate them just lets you rationalize why you didn't develop a good bug-reporting procedure. But the bugs will still be there. With open source the "all bugs are shallow" philosophy seems to mean that the end user is expected to pull up the source and solve the bug when it happens on their own system. That doesn't cut the mustard for the general computer user, or for Nick Petreley it seems.

    The Great Satan actually has a pretty elegant solution for this with Windows Error Reporting. When a problem occurs, IE offers to send a dump to Microsoft and they can analyze the failure. This gives them valuable information about what the most common problems are and lets them do much better bug fixes. You can argue the privacy issues--sending the report is totally voluntary--but at least they've thought about fixing errors and are trying to do something about it.

  219. Re:In a word? -- NO! by Bobo+the+Space+Chimp · · Score: 1

    That still doesn't respond to the criticism, really.

    It wasn't until I worked in the auto industry, where software can't be updated easily, and if there are bugs, it IS a liability issue with recalls. It brings software development to a whole new level that the normal programmer never gets exposed to.

    That's why I laugh at comments like this -- I KNOW the bugs are the result of sloppy development rather than being concerned with getting a feature implemented. I know -- been there, done that.

    --
    I am for the complete Trantorization of Earth.
  220. Once Again... by trongey · · Score: 1

    I've said this every time the topic come up, and I'll keep saying it.

    Nearly every product I buy comes with some sort of warranty. Software comes with a disclaimer.

    Until we demand warranties we will continue to receive crap software from all sources.

    --
    You never really know how close to the edge you can go until you fall off.
    1. Re:Once Again... by trongey · · Score: 2

      Your third paragraph," If the mySQL people release a free database and it loses the occasional record, and its later determined that mySQL was used to track nuclear arms and now some are missing, should the guy who wrote that code by put in jail or fined billions? I mean, he wrote the software he should provide a warranty!" does a great job of reinforcing my point. When software vendors are pressured to guarantee a product they have much more reason to ensure that it works.

      Warranties generally include conditions under which they apply or are void. If the product isn't suitable for a particular use then consumers can make an informed decision about that use.

      --
      You never really know how close to the edge you can go until you fall off.
  221. Is OSS ever finished? by markmoss · · Score: 2

    I wonder how many of those "error" messages really indicate errors? When I am programming, I will put in lots of messages to make debugging easier later on. I will disable them on the final compile, but there have been times when this got forgotten in the rush to release on the deadline. I wonder how often that happens with OSS -- especially since OSS releases are usually not the end of the project.

    Also, messages that were intended simply to show the progress of the program or confirm it went down the correct path often inadvertently sound threatening: "Cannot find file xxxx.xxx", when what you really meant was "No initialization file xxxx.xxx found, using defaults."

    Of course, as the author said, the problem isn't that OSS is worse than commercial software, but that it should be better. Is there anything in OSS as bad as the error message I sometimes got from Win95, "Cannot find file", without the file name and path? Not to mention how Windows allows an application to silently malloc some memory, forget to free it, and repeat until it crashes a different application or the OS itself...

  222. Open sourcers are more open by nagumo76 · · Score: 1

    Closed source software companies don't spew messages because they don't want calls from customers about them. They are happening to be sure, they just aren't being spewed to the screen. If you don't like an error in an open source program, you are free to track it down and fix it.

  223. Open Source Programmers Stink at Error Handling by Anonymous Coward · · Score: 0

    No, they just plain stink! When you don't shower, that's what happens.

  224. Bad examples by GreenBugsBunny · · Score: 0

    While I agree with his reasoning, error trapping is an important part in any program, he picked some bad examples:

    -Ximian Evolution
    -KDE Aethera

    Last I knew, these were still pre-1.0. You HAVE to expect errors in projects that aren't done yet. I have had no direct experience with some of his other examples (Sylpheed, Balsa, or Gnumeric), but I would expect that they are in the same boat.

    Really, the only reason I can think of to justify the types of errors he is talking about is that the program is not done yet. Laziness is inexcusable.

  225. This old fart still misses VMS by killer-rabbit · · Score: 1

    I was introduced to Unix back in the early 80s when I studied for my Masters in CS. All the CS course homework was done on a VAX 11/780 running Berkeley Unix. At the time I was already a systems programmer on the University's DEC10 and VAX/VMS systems. Under VMS you could be confident that if a utility that your script called failed, you would get a clear an unambigous error message about exactly which program died and why it died. In contrast my first introduction to Unix error handling was when I made a change to my .login which caused the error message

    Where are you?

    Every time I logged in. I went to the local Unix sysadmin. He never saw that one before. How did he find out where it was coming from? He grepped the entire system looking for that literal string!!

    After years of working on VMS, I moved to working on Linux. Even after years of building scripts on this platform I will ever once in a while be surprised at how some utility will die or fail in some interesting way that I was unable to catch or detect. In VMS this simply does not happen. But with Linux I find myself doing things like examining output files to verify that the stink'n utility I just executed really did do what it was suppose to do, rather than just failing silently.

    --
    Bill Costa "No good deed goes unpunished."
  226. BS by ame12 · · Score: 1

    here's a real simple template for C error-handling that would remove 99% of all error/unwind conditions.

    int _UpdateRecord(int argc, char **argv) {
    int bTableUnlock = false;
    int bRecordUnlock = false;
    int rc = 0; // always return an error code
    int rc1;
    do { // structure loop
    if (argv != 3) {
    rc = BAD_ARG_COUNT; break;
    }
    if (rc = TableLock(argv[0])) {
    break;
    }
    bTableUnlock = true;
    if (rc = RecordLock(atoi(argv[1])) {
    break;
    }
    if (rc = RecordModify(argv[2])) {
    break;
    }
    // done with structure loop
    } while (0);
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bTableUnlock) {
    if ((rc1 = TableUnlock(argv[0])) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    return (rc);
    }

    The "do { ... } while (0);" construct gives the 'try/catch' effect with no overhead and permits easy cleanup/unwind code.

    If C developers adhered to this type of approach with rigor, IMO we'd have a much better track record all told.

    --
    go tell the spartans stranger passing by, that here obedient to their laws we lie.
    1. Re:BS by ame12 · · Score: 1

      Omit the following lines from the bottom of the snippet... had to completely munge the formatting to adhere to postfilters!

      if (bRecordUnlock) {
      if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
      rc = rc1;
      }
      }
      if (bRecordUnlock) {
      if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
      rc = rc1;
      }
      }

      --
      go tell the spartans stranger passing by, that here obedient to their laws we lie.
  227. Error Handling needs to be part of OO analysis by Skapare · · Score: 2

    Error Handling needs to be part of OO analysis and design. The analysis needs to understand the scope of the class being designed, and error conditions need to be part of that. To the extent that the class analysis suggests that the class can deal with the errors, the design should specify that. All others should be part of the class interface. A clean reusable class has no business outputting text to stderr (unless the basis of the class is to interface with the user or administrator). All error conditions should be given back to the program using the class, with appropriate supporting information. The application then deals with it in some way more appropriate for the user. If an object cannot allocate memory, it should tell the application, not the user. The application can then tell the user.

    There is one danger in this. If Microsoft follows this practice, when a class encounters an out of memory condition, the next day you'll end up with a Fedex arriving labeled "Here is the new RAM your computer ordered for you, courtesy of .NET and Passport. Your account has been dinged".

    --
    now we need to go OSS in diesel cars
  228. Machine exceptions and higher-level exceptions by rpk · · Score: 1

    Once nice thing about Microsoft C++ is that machine-level exceptions (like bad memory accesses) can be turned into C++ exceptions and thus handled like any other library exceptions. Older versions of Sun C++ don't seem to be able to do this. What about GCC ?

  229. Our commercial software checks for errors by Anonymous Coward · · Score: 0

    It checks *every* call to allocate dynamic memory, and rolls back to a stable state if it fails. We test this by making the memory allocation routine faulty (not in the release code of course). If you run on a system that memory hogging programs (for example Java) can be run, you need to cope with out-of-memory conditions.

    Every file operation failure is handled gracefully. All errors are logged in a hierarchy. Memory leaks are checked for in Debug mode (with their source line remembered).

    The code is 3-5 times longer and much more heavily nested than equivalent non-checking code would be. I guess well thought out C++ would help, but some mainframes only like C so that's what we use. If you goto http://www.boost.org you will find that there are zero C++ compilers out there that implement the standard (even GCC fails at some tasks).

    When I'm writing code at home for use, that I may submit to open source, do I do all the rigourous checking I do at home? No way! That comes when the code has all the features I need.

  230. Not entirely true by Anonymous Coward · · Score: 0

    I must disagree.

    Where I work (yes it's closed source, but becoming slightly more open), I developed a networking stack. This code powers financial centers, banks, colleges, etc. Clearly, it must stand up to attacks, buggy clients, allocation errors, and so forth.

    I pulled out the allocator and replaced it with one that would fail randomly. I put in a packet mangler, which would randomly trash bits on incoming and outgoing packets. Then I hooked my client side implementation to the server side, and then pointed a web crawler at the whole mess and beat on it hard.

    It was two solid days of crashes, but you know what? There hasn't been a single crash due to bad data or a failed allocation in the year since.

    A little time invested proactively in error handling goes a LONG way. (And in an anal-retentive way, it's actually FUN.)

  231. The error handling challenge: official solution by TrixX · · Score: 2

    in pseudo-Eiffel:


    allocate_3 is
    require
    SOME_NUMBER>=0
    local
    p1,p2,p3: INT_POINTER
    do
    p1 := malloc(SOME_NUMBER*sizeof(int))
    p2 := malloc(SOME_NUMBER*sizeof(int))
    p3 := malloc(SOME_NUMBER*sizeof(int))
    /* do something with p1,p2,p3*/
    free(p1)
    free(p2)
    free(p3)
    rescue
    free(p1)
    free(p2)
    free(p3)
    end

    Notice how little changed from the original program. You can have a similar C solution and a discussion of the problem (as an example on error-handling) at this document.

    Note that this solution does all this things (and compare with other solutions posted):
    * frees all memory, no matter if things succeed or fail, and even if things fail in the do_something part
    * checks that SOME_NUMBER is valid (non negative) and does not overflow when multiplied by sizeof(int)
    * Has not a deeply nested structure
    * Has an obvious and visible flow control* Works as a non-error when SOME_NUMBER is 0
    * Allows calling routines to get the same kind of clean error-handling
    * works robustly when other error conditions I haven't thought of happen.

    Yes, C allows all this, but it is a pain in the neck, the code gets big and messy, and hard to mantain. So error-checking in C comes at a great cost...

  232. Troll but True: ALL Programmers Stink at Errors by Anonymous Coward · · Score: 0
    Most every programmer I've worked with simply does not have a clue about how to handle (or even log) errors.

    I once spent a couple of hours in a critical customer situation trying to figure out WHICH file a program couldn't open ("ERROR: Couldn't open file. Exiting"). If the idiot programmer had bothered to add a "%s" and the 'filename' variable to his log, I would have seen in two seconds that the customer didn't have his environment variables properly defined.

    Bah!

  233. why is error handling rotten? by dbrower · · Score: 2, Insightful
    often because it visually bloats code, and obscures the "beauty" of the underlying algorithm. How often have you seen a published fragment that says, "error handling omitted for clarity?". The big difference I seen in good commercial application code is that the error handling code is often 1/4 to 1/2 the code bulk. Yes, exceptions can help reduce that. But the key point is being willing to go in and "uglify" your code to do all the error handling. It is unglamourous, and appears to be non-functional, so it is easy to blow off.


    Two things I've learned are that (a) every "if" has an implied "else" clause that often represents an unconsidered error, and (b) those else cases, and other unexpected situations shouldn't be logged, they should be "asserted" in a way that makes the program stop dead, now. That forces you to fix them when they happen. The business the author cites of getting all these messages is truly evil, as it really helps no one, neither the programmer nor the end-user.


    -dB

    --
    "It if was easy to do, we'd find someone cheaper than you to do it."
  234. Bugless code. by Peaker · · Score: 2

    Would opensource programmers thrive, if they use a language, that requires them to provide a logical step-by-step proof of their code, side by side with the code?

    Example of a function declaration, and the mathematical specification it MUST abide, with the logical proof it abides it (In plain English, as the syntax is not thought out yet):

    - Define function sort.
    - Function sort takes a sequence, and returns a sequence of the same type.
    - The returned sequence is of the same size as the given sequence.
    - For-any-element in the given sequence, there exists an identical element in the returned sequence.
    - For-any-element in the returned sequence, but the first, the element before it is smaller-than or equal-to it (polymoprhic smaller-than or equal-to)

    With this mathematical specification, and code that sits next to the logical steps required to prove it abides this specification, we can know for sure that sort() works correctly. Whether or not it leaks memory, is another issue, but disallowing allocation of "global" memory (side-effect allocation), and mathematically specifying memory requirements, you can ensure 0-bugs there too.

    Bugs in mathematical specifications will remain the only source of problems, but those would be rare, because the mathematical code is much more trivial.

    As for performance, there is nothing that the semantics of the actual code must abide to, as long as it is proven to provide the mathematical requirements. Therefore, the performance of the code should be at least as high as any other language, and depending on implementation, and the chosen semantics.

  235. Test-First Programming by Frank+Sullivan · · Score: 2

    Test-First Programming (TFP) is a key part of the Extreme Programming methodology. The JUnit unit testing library has been ported from Java to pretty much every widely used language. So the tools are there to produce robust code.

    Here's how it works... BEFORE you write the body of a method or function, you write a unit test(s) for that function, to make sure it provides correct results for whatever inputs you might encounter. All of those tests should fail. THEN you write the body of the method/function. All the tests then should pass. If the tests don't pass, fix until they do. If bugs are encountered later that aren't caught by the unit tests, use test-first for the repairs - that way, you know your fix actually works. Just keep adding tests as you learn more.

    Now put calling those unit tests into a framework and call it from your makefile. Unit test every time you compile.

    Here are some of the benefits...
    1. If new code breaks old code, the unit tests catch the error, and you can fix it appropriately right away.
    2. You code with far greater confidence.
    3. You keep your APIs very clean, because you have to test them right away.
    4. Your APIs are thoroughly documented by the unit tests themselves.
    5. Maintenance, especially by other programmers, is far easier, because they have the unit tests for reference and can easily narrow down where any bugs occur.
    6. Refactoring is much easier, as any errors caused by refactoring are caught by the tests.

    TRY THIS. It will change your whole approach to programming!

    --
    Hand me that airplane glue and I'll tell you another story.
  236. Article answers the question by mnordstr · · Score: 1

    "...Do you think commercial software handles errors better?"

    The first thing the article says is "Commercial programmers stink at it too, but that's not the point."

    Go figure...

  237. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion

  238. Pft, Error handling is for wusses. by pi_rules · · Score: 2

    I've been asked before in projects, 'What kind of error handling mechanism will you/we be using?'. My response is usually a cocky, "Pft, we don't put errors in our code, so why would we look for them?".

  239. Actualilty, opensrc programmers stink period! by Anonymous Coward · · Score: 0

    It's not just error handling, it's everything handling. I've yet used an install that made any sense, and that I didn't have to guess the lesser of evils in my picks of what to install, which to install, and why I wanted to. It's crazy. It's a tangled web. It's Linux, and it SUCKS!

  240. code w/error handling which doesn't stink by Anonymous Coward · · Score: 0

    From /. Saturday December 16, @05:46PM (#554877)

    Check the easy stuff first:
    1. Make each c++ object have a validate(), assert_valid(), of similar funcation - through a base class - this function has no body if not in debug mode
    All that function does is to
    -- 1. verify that the object has not been destructed (use a boolean flag set to true in constructor and false in destructor)
    -- 2. whatever validation on the internal data in the object (e.g., verify that pointers are not null, file handles are open, etc.)
    2. set each pointer to null after it is free()'d or deleted
    3. (more difficult) write a wrapper library for each and every api function called:
    -- 1. make each function inline
    -- 2. make each function validate all arguments passed into it (e.g., pointers not null, file handles open, etc)
    -- 3. debug print before and after the api call
    -- 4. check return value - call a function that has a breakpoint in it if an error occurs - this function has no body if not debug compile - assert() kills the process in unix and does not allow you to dump the call stack/continue executing if an error occurs
    -- 5. provide you several ways to call the function - see all of the file handling functions in unix that eventually call fcntl(). Usually, you create on function that does everything, and lots of functions that do nothing but provide different interfaces to the do-everything function
    4. for device drivers and other things that are difficult to run under a debugger, set a control-c or similar type interrupt or ioctl() call to dump the contents of the data structures - NOTE see 5 below for problems with non-thread safe printf() type functions
    5. some os's (e.g., ms windows) behave badly if you call api calls or even malloc/free during an interrupt. It is much, much, much better to send/queue a request so that your application can finish whatever it is doing then process the interrupt request normally.
    6. put parameter/data structure validation assert_valid() type macro calls at the beginning of each function to catch bad parameters as soon as possible.
    7. write a function to validate each type of data structure - i.e., an overloaded validate() that takes whatever struct you pass it.
    8. use counting semaphores to watch for overly long queues waiting on each object.
    9. have each thread uses its own private object to store data and not let any thread access shared memory space in the application except through well defined static function calls that use appropriate semaphores/critical sections.

    whoops - black magic type coding secrets for the non-development people revealed.

  241. Excellent Article by Crystalus · · Score: 1
    I'm taking a course at CMU called Dependable Systems. Exceptions and error handling are one of our studied topics.

    Here's an excellent and in depth paper about why programmers forget exception handling, and how we can fix it.


    "Eliminating Exception Handling Errors with Dependability Cases: A Comparative, Empirical Study", Roy A. Maxion, Member, IEEE, and Robert T. Olszewski


    http://ieeexplore.ieee.org/iel5/32/19000/0087784 8. pdf?isNumber=19000

    Abstract:

    Programs fail mainly for two reasons: logic errors in the code and exception failures. Exception failures can account for up to two-thirds of system crashes [1], hence, are worthy of serious attention. Traditional approaches to reducing exception failures, such as code reviews, walkthroughs, and formal testing, while very useful, are limited in their ability to address a core problem: The programmer's inadequate coverage of exceptional conditions. The problem of coverage might be rooted in cognitive factors that impede the mental generation (or recollection) of exception cases that would pertain in a particular situation, resulting in insufficient software robustness. This paper describes controlled experiments for testing the hypothesis that robustness for exception failures can be improved through the use of various coverage-enhancing techniques: N-version programming, group collaboration, and
    dependability cases. N-version programming and collaboration are well known. Dependability cases, derived from safety cases, comprise a new methodology based on structured taxonomies and memory aids for helping software designers think about and improve exception handling coverage. All three methods showed improvements over control conditions in increasing robustness to
    exception failures but dependability cases proved most efficacious in terms of balancing cost and effectiveness. A controlled experiment conducted with 119 subjects revealed a statistically significant 34 percent increase (p
  242. I'd settle for good error reporting by SpacePunk · · Score: 1

    Instead of seeing...
    "Fatal exception in 99384iuls89834 by whatever989834774"

    OR

    "The program has an oopsie!"

  243. Error Messages - so Important, yet so overlooked by SurfTheWorld · · Score: 1

    I'm not sure about open source projects, but error handling and reporting, always seems to fall by the way side. It's so integral, but rarely built rock solid.

    What's amazing is that the programmers just don't get it. As the programmer, you would like people to use your tool, widget, whatever.

    So, let's say Joe User comes along. He's your customer. He's "purchasing" your software. He's not paying you $$loot$$ for it, but you are receiving gain from it in the form of an additional user of your software. So, even open source programmers should treat Joe User like a business treats a customer.

    First time customers are all-important customers. When they first fire up your app, your relationship with them is at a pivotal moment. Will the app work correctly and delight the customer? Or will it flame out and leave a charred core corpse?

    If your app gives false error messages, or no error messages at all, the customer isn't going to trust that the app is a solid tool. Sorry programmer, you've just lost a customer.

    To give you an idea of "just how bad bad can get", I work at a company where the programmers make assumptions about underlying errors. We use Java and there are locations in the code where programmers "catch (Exception e) {" and then the error message that gets generated is really specific like "Unable to find catalog item: 730".

    You can imagine my disgust when I came across this error message when trying to order catalog item 730 after I had just queried and received catalog item 730 as a hit on my query.

    --
    Do it for da shorties
  244. opensource is self-indulgent giving by Anonymous Coward · · Score: 0
    If you want to consider the original design of OSS, it came from people who had a need and built their own software; if it would be useful out in the open, they gave away the source. anybody who found a problem or needed to add additional features to it, they'd write the fix in themselves.

    the people who used it were coders themselves and would make fixes if they had problems -- and none of it was intended for the general-use market.

    to bring it home: i have time to code. I don't use mysql. i am not about to bother spending time to fix a piece of mysql because i won't ever see it work in the real-world. since i don't use it, why should i spend my time debugging software i don't use, don't care to use, and would rather spend coding something more useful to me. Obviously this is a self-serving attitude, and doesn't help the cause celebre, but then again, the average user doesn't have the time nor the ambition to learn to code--and likely has interests outside of whatever it is s/he does on the computer; and none of that affects me or my interests on my computer.

  245. No they don't by fishexe · · Score: 1

    And my only reply to this is, no we don't expect our car to run with damaged parts, but do we expect a single damaged part to destroy everything else under the hood? Yes a scratched cd *is* a programmer's problem, when the software he writes turns what should be a simple problem (can't read the cd, need to get a new one) into a disaster (reboot with a now corrupt hard drive)

    It is the programmer's responsibility to make their programs handle things like this gracefully.

    We wouldn't expect our car to run without fuel, but we would most certainly expect it not to run around wrecking things because it had no fuel. You expect things to work fine once you refuel. In the Word saving example, things could not work fine once some space was cleared because data had already been destroyed.

    --
    "I don't care about the Constitution!" --Bill O'Reilly, November 17, 2009
  246. Exceptions are overated. by pi_rules · · Score: 2
    Exceptions are little more than syntatically nicer glorified GOTO statements. Take a peak into the Linux Kernel and you'll see goto's are actually used fairly often for exception handling. This isn't saying that you -should- use goto's, because they are harder to trace through in code but programmers should at least recognize just how pithy they really are. They're a flow-control mechanism more than a fix-all-error handling mechanism like I seem them being used all too often by beginning programmers. ie:

    try {
    function_A();
    } catch (...) {
    // ignore it
    }

    The only real upshot that I see to exceptions is that it allows the error to traverse back up the calling stack (or down, however you look at it) until somebody catches the thing. All this adds overhead to the entire program though when it's compiled to be made aware of exceptions (in the case of C++... Java just keeps track of it all the time).

    Excpetions certainly -can- be used in a proper manner but they can be abused too. One thing I'm not fond of is code like this:

    try {
    // Open file for reading
    // read password
    // open db connection using passwowrd
    // pull back recordset from db
    } catch (...) {
    // Now what?
    }

    Sure, in the above you should be trying to catch different exceiptions (one for file IO, one for the db, perhaps one for the recordset). Once you start really getting down to a line-by-line error handling mechanism things just get awkward. Larget code blocks leaving you wondering how control got to the catch{} block in the first place when you're not sure which line actually tossed the error out. To do things properly you almost need to be trying{} and catching{} every single line of code IMHO. Guess what? We're back to C style error-return value handling now. I think that was my point to begin with...
    1. Re:Exceptions are overated. by scrytch · · Score: 2


      } catch (...) {
      // Now what?
      }


      I see that form misused too, but it hardly indicates the opposite extreme of catching in every single line of code. It's simple: if you don't know what to do with an error, let it fall through and catch it at the level of its most basic subsystem. If you don't know how to handle a particular DB error, let it propogate to the top of the DB subsystem, and it'll probably involve recycling the current connection. And if you get some totally insane error, let it fall all the way through to the top, generate a user-visible error, consider it a failure of the entire subsystem that generated it, and see if you can gracefully restart it without losing too much state.

      Everything is just syntactic sugar on UTM's or S+K combinator application. Just because it doesn't compute anything differently doesn't mean it doesn't express the concept differently.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  247. Huh? by Orbital+Sander · · Score: 1

    What's wrong with:



    (void)syscall_that_might_return_annoying_error_cod e(...);


    ??

  248. An alert box requires allocating memory by yerricde · · Score: 1

    a) not crash
    b) alert the user, who presumably can do something about it

    Putting up an alert box requires allocating memory, which you cannot do because you are already out of memory.

    --
    Will I retire or break 10K?
    1. Re:An alert box requires allocating memory by Thomas+Charron · · Score: 2

      Thats why you ensure that something is watching the system all along, and ensuring that certain things are within limits.

      Ever notice how Windows will occassionally say 'Your system is low on virtual memory'? Same thing. Presumably, you can get the app to shut itself down to prevent such a catastrophic failure.

      --
      -- I'm the root of all that's evil, but you can call me cookie..
  249. von Neumann on the future of error handling by dha · · Score: 1
    von Neumann, J. (1948/1963). The general and logical theory of automata. In A.H. Taub, ed., John von Neumann, Collected Works, Volume 5: Design of Computers, Theory of Automata and Numerical Analysis. Oxford: Pergamon Press.

    E.g., from page 304:

    Thus the logic of automata will differ from the present system of formal logic in two relevant respects.

    1. The actual length of "chains of reasoning," that is, of the chains of operations, will have to be considered.

    2. The operations of logic (syllogisms, conjunctions, disjunctions, negations, etc., that is, in the terminology that is customary for automata, various forms of gating, coincidence, anti-coincidence, blocking, etc., actions) will all have to be treated by procedures which allow exceptions (malfunctions) with low but non-zero probabilities. All of this will lead to theories which are much less rigidly of an all-or-none nature than past and present formal logic. They will be of a much less combinatorial, and much more analytical, character. In fact, there are numerous indications to make us believe that this new system of formal logic will move closer to another discipline which has been little linked in the past with logic. This is thermodynamics, primarily in the form it was received from Boltzmann, and is that part of theoretical physics which comes nearest in some of its aspects to manipulating and measuring information.

    So basically he was a'wishin' and a'hopin', but sadly, as I said, `the present system of formal logic' from his present is still most all we've got in our present as well.
  250. Recover from this by yerricde · · Score: 2

    If you can't hold on to the user's data if and when you I/O fails then it's time to take a look at the design..

    OK. Yank the hard drive from the computer while it's still on. Now lock the hard drive in a safe. Now try to recover your last hour's worth of changes. Are you implying that all programs should always transparently backup off-site? That would result in unacceptable latency for users on 56K or slower connections who try to edit large documents.

    OK. Now do something to make the computer swap a lot. Now yank the hard drive. How is the OS supposed to continue in such a situation?

    --
    Will I retire or break 10K?
    1. Re:Recover from this by erlando · · Score: 1
      OK. Yank the hard drive from the computer while it's still on. Now lock the hard drive in a safe. Now try to recover your last hour's worth of changes. Are you implying that all programs should always transparently backup off-site?
      No, that's not what I'm implying at all. I'm saying that if and when the I/O fails the program should not crash but it should rather hold on to the users data giving him/her a chance to remedy the problem and try to save again.

      OK. Now do something to make the computer swap a lot. Now yank the hard drive. How is the OS supposed to continue in such a situation?
      You're being ridiculous. Yanking out a hard-drive is asking for trouble. The discussion was about correctable I/O-failures (disc full, bad floppy etc.). No program can do magic.
      --
      Remember, there are no stupid questions. But there are a lot of inquisitive idiots.
  251. or is it Open Source Columnists by Galahad · · Score: 1

    that suck?

    --
    --jdp Maintainer of VisEmacs
  252. Definition for "Enterprise Software" by ahde · · Score: 1

    Enterprise Software: any software application which has a ratio of marketers to developers of greater than 2 to 1.

  253. Expectations consistent with promotions by Anonymous Coward · · Score: 0

    For shrink-wrap software, users' expectations are pretty consistent with corporate advertising and promotions. It would not surprise me to find that even at Micro$oft the _programmers_ shudder at what marketing says about what the products will do. But the companies that over-sell and over-promise what their software will do and how robust it is have noone to blame but themselves. So all the scorn and contempt heaped on them is deserved.

    Open source on the other hand...
    a lot of what has been written so far about programmers not doing enough testing and not bothering with error handling is, unfortunately, right on. I think it would really help the community, (and all programmers) if some of the more highly respected (and more famous) programmers _specifically_ addressed how they do error handling, with examples, in some sort of symposium or round table (maybe O'Reilly, RedHat, IBM could sponsor?). On the other hand, maybe they don't want to subject their code to such a harsh light. They could always use other programmer's code as examples, I suppose ;-).

  254. Re:Too specific: Programmers Stink at Error Handli by Anonymous Coward · · Score: 0

    Dude, if your can was a hover craft that went 600 miles/hr, you would drive it whether or not it stalled out at every light, rather than drive a yugo that went 60 miles an hour and never crashed. People drive Harlys, and they run rough and always need fixing, but they are so much cooler than a gold wing.

  255. Error numbers are pure evil by Per+Abrahamsen · · Score: 2

    The time for numbers have passed. Use a short mnemnonic keyword instead, computers handle them just as well as numbers these days, and humans handle them way better.

  256. Re:That all depends on... your selection of course by Krelnik · · Score: 2

    Open source, like everything else in life, strictly follows Sturgeon's Law: Ninety percent of everything is crud

  257. Better error checking for C by kimbly · · Score: 1

    Check out VAULT. It's very much like C, but it's incorporates research into modern languages like ML. The compiler makes a lot of bugs (for example null pointers and memory leaks) simply impossible to compile. The compiler isn't available yet, but they claim it'll be available in "a couple months".

  258. No indication of error by sfe_software · · Score: 2

    I use KMail (under Gnome no less) for my email. It's a great client, and handles tens of thousands of emails without much fuss.

    24 days ago yesterday, I transfered all of my account settings to a new username. Somehow I managed to forget to chown 'kmailrc', a few directories deep. I didn't notice this until I closed and re-opened KMail 24 days later...

    So after 24 days of adding POPs, tweaking filters, etc, I find out these things never were written to the config file. I found this out NOT by an error message -- KMail pretended everything was fine. I only found the problem after losing the settings that had apparently been in memory for the last month...

    Frustrating to say the least; I would have appreciated even "Can't open 'kmailrc': permission denied" or better yet a chance to chown and retry. Nonetheless, I haven't found anything better (and it was my screw-up), and I don't have time to try and get Evolution to compile... and anything beats going back to Windoze...

    --
    NGWave - Fast Sound Editor for Windows
  259. Don't be so helpless! by Simon · · Score: 1
    a) not crash
    b) alert the user, who presumably can do something about it

    Putting up an alert box requires allocating memory, which you cannot do because you are already out of memory.

    Then free up some memory first! Chances are that you already allocated a heap of memory before failing. Now that you can't finish the operation, free the already allocated mem and then display the error message.

    Basically cleanup and free any now unneeded resources and then display the error.

    Don't be so bloody helpness. sheeessh...

    --
    Simon

  260. The difference is in error reporting. by DunbarTheInept · · Score: 2

    I don't think open source software is more error prone. I just think it's more likely to *tell* you when an error happens rather than just sweep it under the rug and pretend it never happened. OSS doesn't lie. If something went wrong, it TELLS you. I'd love to see that kind of behaviour out of my Win98 desktop, so I could actually figure out why it keeps launching goofy things at startup that I don't even have installed (resulting in blank windows I have to close by hand.)

    --

    Don't label something "offtopic" unless you know the topic well enough to tell what's on topic.

  261. Re:you didn't read the article by ameoba · · Score: 2

    Titling an article "Open source programmers stink at error handling" is an inflamatory statement. Regardless of what is actually in the body of the article, you can't place it in a Linux/OSS oriented site without expecting that exact type of reaction from the /. crew. Hell, he probably called it what he did -hoping- to get a front page mention on slashdot.

    --
    my sig's at the bottom of the page.
  262. Re:Killed accting server during merger & yeare by jelle · · Score: 1

    "One thing I hate is a lot of OSS projects require certain libraries that are un available."

    Tip: If you put it in a debian, package, then apt-get will get all the libraries it needs if they are not installed on that particular system. apt-get source is also really sweet to make small patches to existing programs.

    --
    --- Hindsight is 20/20, but walking backwards is not the answer.
  263. Re:That all depends on... your selection of course by flink · · Score: 1

    I'm inclined to agree with you, except that we mostly make use of straight-forward database wrappers. These same DLLs are use by an out of proc service that imports files into the dataabse and does book keeping, and it has never hung. So maybe it's a bad interaction between our code and IIS. I wish we could proove it was a problem with our code -- at least then we could fix the bloody thing ;-)