DelegationInJava

From SPA Wiki

Jump to: navigation, search

During the workshop 'Delegation in Java', the organisers Erik Groeneveld and Willem van den Ende programmed together with the participants on 'Delegator'. You can find a brief explanation of Delegator here: http://www.cq2.nl/nl/oss/delegator/toon . The introductory slides and the original session proposal can be found here: http://itor.cq2.org/en/oss/delegator/delegationinjava/toon .

Willem worked with Ivan Moore on extending Delegator, so it could easily implement the state pattern (the example we used was a simple pseudo html parser, which changes its behaviour depending on whether it is parsing inside a table or not). By the end of the workshop, we were not quite done yet, but we had created 'multiple implementation inheritance' as a first step. This means, that one can 'extend' from more than one class. You can read Ivan's comments in his blog: http://ivan.truemesh.com/archives/000226.html .

Another pair also worked on the state pattern. Others worked on implementing observer.

It was clear, that there is still some work to be done on Delegator, and that the concepts, as Ivan Moore put it on his blog are 'interesting to get your head around'.

If you've never seen delegation in other languages (such as Self or Ruby) it is difficult to understand at first, as some participants found out. Once you know how to use it, it is very powerful.

As a result of the workshop, some convenience methods on Delegator were created, that make it easier to use it for specific cases, such as the multiple implementation inheritance mentioned before. Another result was that some defects and omissions in the current implementation were found. One of these was the addition of a 'cast' method, so one can cast the composite object created by Delegator to any of the objects it contains.

Back to OtTwoThousandAndFourOutput.