Hey,

I've been looking through the runtime code today and noticed that the 
algorithm to "check module, then layer, then used layers" is replicated 
like umpteen times for various purposes. That sucks. It is also 
implemented in the instance level rather than the model level, even 
though many of the things being done should be on the model level. That 
sucks too.

One thing that really sucks is that service dependency injection binding 
*should* be done once in the model, and then just "executed" at runtime. 
This will be faster, and will also help the visualizer, since it could 
then trivially show all service references that have been bound to a 
particular @Service injection.

So I attempted a solution with visitors, which have helped us already in 
other places. It turned out to work very well, which means that the 
"check module, then layer, then used layers" algorithm is in *one* place 
in the code (in the model), and then visitor implementations decide what 
needs to be done for the various cases. Much much nicer and easier to read.

Apart from also pushing many of the algorithms down to the model layer, 
it makes many of the results cacheable, as the visitor after usage 
contains the result of the computation. Just put that in a cache, and 
subsequent calls will be superfast.

I hope to be able to finish this tomorrow.

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to