What lack in the object-oriented programming to invent a new concept ? According to Rickard Öberg, best practices and design patterns are not completely respond to all modelling problematics. The domaine driven design shows that the objects have different behaviour according to the contexts in which they are used. An object model must be adaptable in the environment where it live. Although a domain defined a set of common business objects their operation and behaviour expected changes as applications needs. To meet this expectation Rickard Öberg and Niclas Hedhman have developed a framework: Qi4j (chee for jay). Based on the concepts of AOP, DI and DDD, they developed the composite approach implemented entirely with Java 5.
The framework isn’t finished yet, but the idea is really interesting and extends existing concepts implemented in Improve Foundation and Spring (dependency injection, inversion of control). We find the layer concept (one advantage of IF vs Spring) but also module and assembly. The Composite is an object composed of different « Fragments » which can be
- « Mixins »: a set of implementation of interfaces,
- « Concerns »: method interceptor (concept of the AOP)
- « Constraints » : constraints on method input / output (concept of design by contract)
- « SideEffects » : action not really linked to the object, which can be reused by different objects
The advantages are mainly a model much business closer that responds well to Eric Evans’s DDD concept. The drawbacks still learning and therefore adoption. Finally remains about the performance, which is not yet done. I do not think this is a competitor to Improve Foundation or Spring but rather a complement to which we will have an interest.
Qi4j : the documentation is still being developed but the concepts are well presented
DDD presented by Eric Evans in two parts:
