Wednesday, February 3, 2010

Checked vs Unchecked: That old chestnut!

I really thought this one had gone to bed, but recently a debate on checked vs unchecked exceptions arrived at my door.

I'm associated with this Butler IO, it's basically a helper for getting and writing resources.

Does things like this:
String fromClasspath  = ButlerIO.textFrom( "res:articles/steve_jobs.txt" );

The workings of textFrom basically come from this method.
public static byte [] bytesFrom(InputStream inputStream) {
    ByteArrayOutputStream out = new ByteArrayOutputStream(BUFFER_SIZE);
    try {
        copy(inputStream, out);
 return out.toByteArray();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

The project wasn't up a day and a complaint was received about catching the checked and re-throw a runtime exception. In their words; "... throwing an unchecked exception here is just pampering the user in false safety. Checked exceptions are there for a good reason"

This project was built to help make clean code and has followed Bruce Eckel's thoughts on this subject of exceptions.

I can't think of a time when you can recover from an IOException, and this way can identify programmer errors early and clearly at runtime. The utility doesn't enforce you to catch any exception, which makes for cleaner code...right?

Isn't the point that any error handling be the choice of the caller; Butler can't do anything about a missing file, and doesn't presume to know what the caller wants to do either.

Have I got this wrong? I don't think so! But I would appreciate some feedback from you guys. Thanks.

Tuesday, February 2, 2010

Do you have conference envy?

Conferences are big business. It's the hotels, it's the conference centres and its the major players sponsoring the event. In the technology sector — and software — you can go to QCon, ApacheCon, JAOO, and those are just the big ones.

These yearly conferences are filled with some of the best — and dare I say iconic — players in the business. The people that the write books you study, the blogs you read, the practices you follow. These gatherings give you the ability to see, hear and possibly interact with these incredible minds....but only if you are rich!

At £2000 a piece — and that's just to go and not including hotel and travel — it's not an amount easy to swallow or cough up. Perhaps if the company you work for has money or is willing to part with money on your behalf, you might be able to attend one of these grand events. If you work for a start up or are self-employed or a company that doesn't value its employees attending gala events, you're bang out of luck.

You'll just have to wait and hope for the video to pop on InfoQ.

The video of the presentation will often suffice, all stuff no fluff. But what I object to is this notion that these conferences are a "must do". Is this conference envy? Potential employers ask about potential employeses in interview and damn it I even ask people interviews if they have attended them. Some even dare to bill themselves as "By Developers for developers." What a pill of poop!

Conferences aren't always a lost cause. There are good value events which enable passionate developers to mingle the the like minded and hear from their idols. XP Days has always been reasonably priced and there was even a free Scale Camp in London late last year that boasted some impressive speakers.

But just remember: 2000 quid can buy you a lot of books.