Exceptions are for exceptional situations

Like drumming up traffic to your site, perhaps? ;)

On Monday Joel Spolsky wrote a controversial piece about exceptions; he hates them. Much blog cross linking and local discussion ensued. Today he’s followed that piece up with a piece that basically says ’exceptions can be good and they can be bad, it’s a design tradeoff’. Which, of course, takes all the controversy out of the original posting; strangely I was expecting something like this…

When I first saw the original posting that kicked off ‘Joel thinks exceptions are evil day’ I wondered if it were some kind of test… The previous day he’d written a nice piece on Unicode that had got a lot of the ’no-value-add blog repeater brigade’ going. The piece was widely commented on in the blogs that I read, but most of the added value came from the discussion boards on Joel’s site, where people were less interested in just pointing at the original article and going ‘Joel good’; links to Unicode resources, intelligent discussion on the issues and some rebuttals on the slur on PHP.

Writing a well thought out article like that once you’ve worked hard to get a name for yourself must generate a whole bucket load of traffic to your site. That’s great. Joel’s site is a useful resource and it generates sales for him in a very ‘clue train manifesto’ style. I wonder if he was curious to see if there was a quicker way…

The article that caused ‘Joel thinks exceptions are evil day’ was probably much quicker to write than the Unicode one. I wonder which generated most new traffic to the site… You can just imagine some marketting droid berating Mr Spolsky about the amount of time that he’d spent crafting the Unicode piece. “Joely baby, there’s no need to put all that effort into a piece; you don’t need references and useful content in this world. Just yank their chains and they’ll come; watch this.”

But probably, it was just so that he had a nice tag line for the piece that follows the ’exceptions are just a design trade off’ follow up piece. Joel, you worked your audience perfectly. ;)

For what it’s worth, I agree with Ned Batchelder’s position on exceptions; I don’t care if you don’t. Some people seem to love turning these things into religious arguments; they can go round and around for weeks and never bother to take any notice of the other side’s argument. As with TDD, I personally find that in the environment that I work, using C++, on Windows, that exceptions help me write better code. It works for me so I use it. It doesn’t work for Joel so he doesn’t. That’s it.