More on exceptions and status returns

Thursday 16 October 2003This is 20 years old. Be careful.

Well, ever since Joel took notice of my article about exceptions and status returns, the weblog joint has really been jumping. Joel asks me to give real examples rather than “DoSomething” for function names. It’s kind of a funny request, since his example used functions named “f” and “g”, but it makes sense to ground this in reality.

In response, I wrote another article laying out my view of how exceptions fit into real code: Exceptions in the rainforest.

A number of people rose to Joel’s challenge before I could:

  • Len Holgate has a good example of how to handle the “failure during installation” scenario.
  • Jesse Ezell tries his hand at it, though I don’t think I like his first try: checking the class of the exception seems a particularly awkward defense of exceptions.
  • Steve Tibbett shows some other ways to slice it (though I don’t approve of “catch (...)”).


Joel fell on his face on this one. He just showed his full ignorance of vital c++ practices. Poor guy, he still probably thinks that VB is on par with serious programming languages like c++. What was that that Dijkstra said about BASIC? ;)
What Edsgar Dijkstra said is:

"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."

He also had nasty things to say about FORTRAN, PL/I, AND API as well as COBOL and APL. I wouldn't be too sure that he would be any kinder to C++ or Java programmers ;-)

Here's a reference to Dijkstra quotes:
Oops. Sorry for the typo ignore the "AND API as well as"


Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.