IT Poetry


A fragment of Qi4J
November 22, 2007, 12:09 am
Filed under: personal, Programming | Tags: , , , , ,

Qi4J logoI had the pleasure of attending the Oredev conference here in Sweden last week. Where Richard Oberg (Öberg, founder of JBoss) introduced the concept of Composite Oriented Programming (COP), specifically Qi4J with slogan “Classes are dead, long live interfaces”.

Composite oriented programming is about fragmenting the constraints, concerns, side effects and actual behavior of your beans into fragments (implemented by “Mixins”) which are brought together by a composite.

These are some things you can do with composites:

  • A typical constraint of a bean is to not allow null values. -Move this constraint to a generic constraint checking for null or empty values in the setters.
  • A typical side effect of a bean is to invalidate a cache when invoking a setter or logging invocations that take an unexpectedly long time. -Move these side effects to generic mixins.

These examples look very much like Aspect oriented programming, but I think that fragmentation should be applied on a higher level in the application design. Another difference with AOP is that control of the aspects of an object is moved from the AOP rules into the definition of a composite, which should give more transparency and flexibility.

If you are interested, the Qi4j website is still quite immature, and it is quite frustrating trying to penetrate the essence of the framework, but i recommend starting with a Composite Example.

The most interesting part of the Qi4J initiative is the model in which it is developed. After their presentation, I got a chance to speak with the guys from Jayway which have sponsored the project so far. Qi4j is hosted on OPS4J (Open Participation Software for Java), which is working like a “Wiki brought to coding”. The idea with the OPS4J hosting is that anyone should be able to contribute without having to be accepted by the group. The commits will be moderated like on Wikipedia. This is probably a fantastic way to get people to start contributing. But I suppose it is very risky not having control over the commiters to steer the project towards a road map. It shall be very interesting to follow Qi4J, and as the Jayway people said: “Now we are what the Spring framework was in 2003”.