commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias J <>
Subject [chain] Pre-conditions
Date Fri, 13 May 2005 12:25:16 GMT
I have just started using Jakarta Chains to refactor and evolve an existing 
project. I've had thoughts around this for a long time, and finally got 
around to it. When actually working with this API/pattern, a few questions 
come to mind, mostly related to the dependencies between different Commands 
in a Chain.

The post-conditions of a Command should of course be checked using unit 
tests. But what is the best practice for handling pre-conditions (i.e. 
context must be of type MyContext, context must contain value for key 
"myKey", value for "myKey" must be of type MyClass)?

Naturally pre-conditions should be documented in the JavaDoc of the Command 
implementation, but this is not always the best for mainainability and 

- Should all possible Chain combinations be unit tested?

- Or would it be an idea to create a sub interface to Command to add, say, 
This could of course done using AOP and configuring aspects via 
annotations, for example
   @ValueType("myKey", MyClass.class)

- Or maybe one could elaborate this even further, creating rule object sets 
returned by Commands as pre-conditions and post-conditions, so that a Chain 
would be responsible of making sure the different Commands are compatible 
when added using addCommand()...?

Does anyone else have any thoughts about this?

   /Mattias J

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message