Thursday, September 27, 2007

Sublime By Contract

Over and over again, I am amazed by the genius of separating the What from the How.

From the micro-level of interfaces to the grand schemes of protocols, the inherent beauty of The Contract is cool. For two reasons:

  • it clearly defines the expectations
  • the brilliant, creative solutions to Gettin' It Done

Example 1: The History of Couriers

The contract: get stuff from A to B, in X time units, for money. Classic.

From the Pony Express to banzai bicycle messengers, onward up to FedEx and UPS, each step of the courier business is an intriguing story. I don't know if there is a popular history of couriers but there should be. The pioneering spirit is abundant and the technology is outrageous. Fascinating.

Example 2: IP over Avian Carriers

It is a silly example but delights me now as much as it did when I first read about it, ages ago. Birds and nerds team up for some networking mojo.

Example 3: Inversion of Control

In the early days of Java, it was very neat to use Collection, List, and other interfaces because of the latitude of changing the implementation; e.g. one might go from a HashMap to a TreeMap, based on profiling. Swing and distributed computing use 'em all over.

For straight-up apps, though, it seemed like we never really changed the implementation, even with factories, but it was cool nonetheless. We could change them if we wanted to.

Then came the IoC containers and the interface had a resurgence: Version 2.0. Now, it's very easy to change out implementations. It's a great feeling to use a set of mock objects for daily unit tests and a full-blown DB implementation during nightly integration testing. More than just using a contract, it's the tactile sense of different implementations. A sense of change.

Example 4: Terracotta

I recently went through the Hello Terracotta exercise on Alex Miller's blog. Check it out.

Terracotta is the latest mind-altering idea I've come across. I'm not even sure that I understand the implications of what it does, just yet. It really makes one say 'wow' and 'huh?' at the same time.

I do understand that it is sublime by contract. Get this: it honours the semantics of the Java Memory Model, and yet in doing so, it dopes up your (designated) classes and JVM so that it can shuttle your data to a central service (this phenomenon is called Network Attached Memory). In the simple example, one's app/JVM can go up and down and yet work with 'persistent' objects.

The kicker is that your code doesn't need to know: there is some serious mojo under the hood, and yet the contract of the Java Memory Model still holds.

If the standard JVM is a bike courier, Terracotta is UPS. Your stuff still gets done, but more efficiently.

There are some ideas that wouldn't occur to me even if I were on a desert island for 100 years. One of them is separating -- in such a weird way -- the contract of Java memory semantics from the implementation.

That's sublime.


Alex said...

This is mostly tangential, but on the first example, the book The Immortal Class is a great read about bike couriers in Chicago. It's a little out there but is really vivid. If you're into biking, you'll probably enjoy it.

Anonymous said...

It is called the Entropiauniverse ped world. In the Entropia world, Entropia Universe Gold is important. Adventures and social interaction with other participants with Entropia Universe Money. Buy Entropia Universe Gold is a real thing to you. It is also possible to offer users the opportunity of buying and selling cheap Entropiauniverse ped.
It is also can not live without eve isk. Here, for the violence or robbery had been friends apologize in the eve online isk. I request members are on the local increase or decrease in the number of judgments quickly in buy isk. The game has a good excellence is that the cheap eve isk. The other side rather than back into the space station is POS, and buy eve online isk.

Anonymous said...

Now do you worried about that in the game do not had enough Sword of the New World Vis to play the game, now you can not worried, my friend told me a website, in here you can buy a lot Sword of the New World Gold and only spend a little money, do not hesitate, it was really, in here we had much cheap snw vis, we can sure that you will get the Sword of the New World money, quick to come here to buy vis.

Now do you worried about that in the game do not had enough twelve sky Gold to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 12sky gold and only spend a little money, do not hesitate, it was really, in here we had much twelvesky Gold, we can sure that you will get the 12Sky Silver Coins, quick to come here to buy 12 sky gold.