Jul 31

Not only did Cisco see the need in inventing their own RPC protocol, now they become the third major player in a short time to open source it, or at least that’s the aim. The opening of Facebook’s Thrift was pretty much quite. But, as with anything touched by todays Midas, Google’s Protocol buffers stirred a bigger debate on the merits of RPC.

I think this is an area that merits some further discussion. By now, we’ve figured out that RPC is a bad fit in heterogeneous, cross-domain integrations. But, in the case you own both ends of the wire and you need some serious throughput and low latency communication, these types of protocols is likely a better fit. At least in the mega environments some of the web companies run these days. It’s interesting to follow along with the rapid development of such infrastructure, even though they are out of the hands of most of us. At least for now.

So, with all three combatants now in the open. Let the fight begin.

Jul 30

Today I was creating a spiced up version of the TCP connection state diagram from RFC 793 for some documentation. It turned out pretty nicely so I thought I should post it here. It’s a 1-to-1 conversion of the diagram in the RFC. The theme is based on the very nice GTD wallpapers. Drawn in Visio, source available here

TCP connection state diagram.

Click for a full size version. If there is any interest, I’ll provide a SVG version as well.

Feel free to comment with feedback and corrections.

Jul 17
Terse code be removing newlines
icon1 Niklas | icon2 Tags: , . | icon4 07 17th, 2008| icon3No Comments »

While I’m a big fan of Scala, and in general like to write more stuff in less code, I’ve seen a few cases of people showing examples of how terse the code gets once its in Scala (or Ruby or what ever) compared to Java. However, in many of those examples, the effect is solely due to using one liner code rather than those, actually readable constructs that code conventions has taught us to use. Not to pick on this post in particular (it does in fact mention that they are not satisfied with the result), but it does show my problem. Of course, that Java code could be written like this:


        Vector v = new Vector();
        for(String s : map.keySet()) if(s.startsWith(prefix) && !s.equals(prefix)) v.add(s);
        return v.size() > 0 ? v.toArray(new String[0]) : null;

Is that generics beautiful? Not exactly. Do we have to do a lot of stuff the compile could do for us? Yeah. But I would argue that this code is as readable as the Scala code in the post.


(for (val key < - map.keys if key.startsWith(prefix) && (key != prefix)) yield key).toList match {
    case Nil => null
    case list => list.toArray
}

Which is to say, not a lot. And it’s not significantly more verbose. Now, as the comment on the post show, there are better ways of doing this which really does make Scala shine. That’s the examples we need.