Developing software is like working with iron

January 7, 2010

When I talk to family about my job, it is always hard to explain what I’m doing. Yes.. I write software.. and no.. I can’t help you with your Windows problems. But some parts of software development can be compared to working with iron:

  1. When you start, you can create small parts and connect them to create bigger parts, just like with Lego or Meccano
  2. When you have accomplished a lot, in some cases it feels good to do fine tuning and put the dots on the i by getting a very fine sandpaper and polishing it: just feeling proud.
  3. If there already is existing software and some parts aren’t not behaving as you want it to behave, you get a crowbar and try to bend it in shape. In some cases a crowbar isn’t sufficient and you need to get something like a sledge hammer or blowtorch
  4. In some cases the quality is that bad, that a sledge hammer will not help. The best thing to do is to melt everything and start from scratch.

Multiverse and the 2 Phase Commit

January 7, 2010

Currently I’m working on a 2 phase commit in Multiverse; a Java based Software Transactional Memory implementation. The cool thing about the 2 phase commit in Multiverse is that isn’t slow (something most developers fear when they hear about 2 phase commit). It only says that the transactions should do the commit in 2 parts:

  1. prepare: make sure that the transaction has no read/write conflicts and make sure that the sources are ‘locked’ so that a commit is going to succeed
  2. commit: does the actual writing of the changes

So if multiple transactions need to commit/abort atomically; the all need to be prepared first. If this succeeds, they all can continue to the commit (that is not going to fail). And if the prepare of one of the transactions fails, they are all aborted. A 2 phase commit in Multiverse can be done completely in memory in a single JVM without any network communication, so it is very very fast.


I’m still working on a nice ‘synchronization’ structure called the CommitGroup. The CommitGroup is the token that needs to be shared between all transactions that all need to commit atomically:

CommitGroup group = new CommitGroup();

When a transactions want to participate in the commit group, and are not able to complete it, you can do something like:


And if it is the transaction that is able to complete all the commits of the CommitGroup, you can do something like this:


Isn’t that cool? The 2 phase commit and the CommitGroup are going to be part of Multiverse 0.4 which is going to be released at the end of this month on the new location at Codehaus, including a complete new website with a big reference manual, tutorials, introductions and of course a lot of new features and performance improvements. The main focus is going to shift from creating a cool toy project, to something really usable like Hibernate.