Joel on Software
Oct 23: Seoul:
WebAppsCon
Oct 27: Boston:
SD Best Practices
Feb 24: Miami:
Future of Web Apps
Search:

Wanted: Software Engineer at Getty Images (New York, NY 10013). See this and other great job listings at jobs.joelonsoftware.com.

15


This item ran on the Joel on Software homepage on Wednesday, October 15, 2003

DoSomething()

Ned Batchelder has written a spirited defense of exceptions.

With status returns:

STATUS DoSomething(int a, int b)
{
    STATUS st;
    st = DoThing1(a);
    if (st != SGOOD) return st;
    st = DoThing2(b);
    if (st != SGOOD) return st;
    return SGOOD;
}

And then with exceptions:

void DoSomething(int a, int b)
{
    DoThing1(a);
    DoThing2(b);
}

Ned, for the sake of argument, could you do me a huge favor, let's use a real example. Change the name of DoSomething() to InstallSoftware(), rename DoThing1() to CopyFiles() and DoThing2() to MakeRegistryEntries().

OK - Cancel

OK-Cancel Comic StripKevin Cheng: “There are four major classes of problematic programmers that I have worked with...”

And Back To Exceptions

There's no perfect way to write code to handle errors. Arguments about whether exception handling is "good" or "bad" quickly devolve into disjointed pros and cons which never balance each other out, the hallmark of a religious debate. There are lots of good reasons to use exceptions, and lots of good reasons not to. All design is about tradeoffs. There is no perfect design and there is certainly never any perfect code.

Announcing the Joel on Software Book Club

Small Things Considered book cover imageThe imperfection of design is the theme of October's Book of the Month. Did you ever think about why calculators have 1, 2, and 3 on the bottom row while phones put those keys on the top row? Why did the high beam headlight switch migrate from a floorboard pedal to a toggle on the steering shaft? Whatever you're designing, from the error handling facilities of your software to the fat handle of a toothbrush which is highly ergonomic but can't fit in anyone's toothbrush holder, you have to trade off things that can't really be balanced against each other. And no matter what you do, you'll be subject to criticism, much of it valid.

Henry Petroski, who can write a 448 page book about the common pencil and make it fascinating, has done it again, this time with an excellent book about why there is no perfect design. All design is about tradeoffs, and if you don't believe me, this book offers dozens of examples from everyday life. It even offers a candidate for the best designed object on the planet (the three-legged plastic nubbin that keeps your pizza box lid from sticking to the cheese) and shows why even that is imperfect. Small Things Considered: Why There Is No Perfect Design is another great read and it's the first Joel on Software book of the month.



My new book is here! Apress has just published a new collection of 36 essays from Joel on Software, aptly named More Joel on Software. Get yours today! Available from Amazon.com or wherever fine cheese is sold.

About the Author: I’m your host, Joel Spolsky, a software developer in New York City. Since 2000, I've been writing about software development, management, business, and the Internet on this site. For my day job, I run Fog Creek Software, makers of FogBugz—the smart bug tracking software with the stupid name, and Fog Creek Copilot—the easiest way to provide remote tech support over the Internet, with nothing to install or configure.

Enter your email address to receive a (very occasional) email whenever I write a major new article. You can unsubscribe at any time, of course.

Email:

 
Home | Email | Bug Tracking Software | Remote Assistance | Complete Archive