Metacosm
This is not a tag line!
This is not a tag line!
Nov 28th
It’s nice to relax after a long day of work… Sacha‘s most recent post reminded me of the excellent Kiwi humorist duo: Flight of the Conchords. Here’s my favorite song of theirs:
Enjoy!
Nov 28th
I attended my first NSCoder Night at the local DC chapter, initiated by Jose Vazquez. We didn’t get to talk much about Cocoa but that was kind of expected when you first meet new people. Fun! Hopefully, I’ll find some time to attend regularly and sharpen my Cocoa skills.
Thanks, Jose!
Nov 26th
They say a picture is worth a thousand words… Here’s collection of pictures, from recent posts of blogs I read, which quite accurately describe my recent mood…
Let’s start off with The Argyle Academy:
Next up is Indexed:
A little xkcd:

And last, but not least, Sunday Secrets:
Now, it’s not all bleak and doom. Maybe, a little case of grey-colored glasses…
Nov 23rd
Nov 19th
I finally got around to update my flickr account with some pictures from past vacations, some from last winter with my family at La Plagne and some from my summer vacation with friends in the mountains above Grenoble, both in the French Alps. I still have some that I’d like to upload… Maybe it’s time to consider a pro flickr account…
Nov 14th
Java 5 has some nice improvements over Java 1.4 that really make writing code simpler… Then again sometimes simpler also means dangerous. Case in point, Java 5 auto-boxing. Consider the following method:
public Boolean isValid()
{
// if we don't have any data, we cannot decide so we return null,
// which is why we're using Boolean instead of boolean
if(data == null)
{
return null;
}
else
{
// data.isValid() returns a Boolean
return data.isValid();
}
}
As you can see, we are using Boolean as a return type to provide a ternary result instead of a simple true/false decision: sometimes, we just don’t have enough information to decide and we want to know that. So far so good!
Now, we’d like to use this method within a test:
...
if(isValid())
{
//do something...
}
This code compiles with Java 5 thanks to the auto-boxing mechanism. It would be an error with Java 1.4, however, the compiler in Java 5 transparently converts the Boolean return value to a boolean. Everything seems great: we have a method that provides more information and the code is as easy to read as it was with a method that simply returned a binary result. Except that now, this last piece of code can actually fail and cause a NullPointerException because the compiler converts the code to something similar to:
Boolean tmp = isValid();
if(tmp.booleanValue())
{
// do something...
}
thus causing the NullPointerException if tmp is null… Tricky!
Now, this is nothing new (though I only realized it when I was about done with this post), it’s been pointed out several times already… However, I stumbled on it just now and though I figured out pretty quickly, it was still somewhat surprising. On the other hand, the advantage of only starting to use a Java version so late after it’s been released is that all the potential pitfalls are fairly well documented by now!