Servergeek
Mickey Williams' weblog


Powered by Blogger Pro™

Wednesday, October 15, 2003

Exceptions Not Considered Harmful


When politicians make outragous claims (often in favor of some special interest) a favored tactic is to arm themselves with quotes from a trusted cultural icon. By wrapping themselves in a cloak of respectability and patriotism, their work aquires a gleam hijacked from say, Lincoln, Washington, Kennedy, or even Captain Kangaroo. (This tactic is especially effective against audiences that spend their days glued to the riveting intellectual discourse of Fear Factor or the Bachelor.)

In a similar vein, when a person with a poor foundation in software engineering wants to make an outrageous claim, what better icon to enlist than the ghost of Edsger Dijkstra, as Joel Spolsky has done in an utterly inexplicable rant comparing exceptions to the GOTO statement. BTW, if you haven't read Dijkstra's (in)famous letter to the ACM, do it now before you embarass yourself like Joel.

These rantings are so far off the mark, I wonder which of my hundred or so pages of writings on exceptions I should lead with? As I said in comments on Brad's blog, I'm just vapor-locked. Or should I use an excellent discussion on exceptions from Meyer or maybe a less academic view from Gosling? In the end, I think I'll just shake my head and wonder how Joel ever became any sort of an authority figure on software development, because he has obviously missed several important lectures that any undergrad CS student would be expected to have taken. I've never been very impressed with him - here's his initial take on .NET, which was another poorly researched rant. The irony here is that had Joel actually attempted to enroll Dijkstra into Joel's way of thinking on exceptions, Dijkstra would have probably thrashed him to within an inch of his life.

[Ignores previous paragraph drops hockey gloves anyway]Here's what I believe:

  • A method must either suceed or fail
  • Return codes only exist because older C programmers refuse to repent or die
  • I'll consider going back to error codes only after somebody manages to get all of my library vendors to agree on a single scheme for return values
  • The expression on a student's face the first time they encounter S_FAIL(hr) is a great argument against error codes encoded in return values
  • Libraries that attempt encode error information in return values are the programming equivalent of a drunken, unemployed neighbors with overgrown lawns and rusted engine-blocks in their front yards.
  • People that develop and defend those libraries are like hillbillies with missing teeth ranting about black helicopters and gov'ment conspiracy theories. And I say that as a proud ex-resident of rural north-eastern Louisiana, so I know what I'm talking about.
  • And finally, a GOTO isn't the ugliest thing that I've ever seen in a software program

Home