Solutions to Robot-Leg-Problems

239 views
Skip to first unread message

Oli

unread,
Mar 17, 2008, 8:43:08 PM3/17/08
to google-guice
Hello guicer!

I don't know if there is some interest in this topic... just for the
case.

In my project I meet this problem very often: I have several
algorithms working on certain data sets; sometimes many instances of
the same algorithm on different views on the same data set, and so
on... classical robot-leg scenarios.

I have worked out some solutions I'd like to share, discuss, and maybe
evolve together - if desired.

In certain small cases it's of course possible to subclass and use
different annotations. Not very satisfying - as I think.
For those simple cases I worked out an AssistedProvider which works
pretty much like the AssistedFactory mechansim (see FactoryProvider)
but does not need to have a factory. Instead it takes instances or
keys during configuration for the robot-leg-parts. The rest is
injected as usual.

For more complex cases I use Injector chaining. I.e., create an
Injector for the robot-leg, fill in necessary Providers from the outer
injector, and as return fill some Providers into the outer injector.
(quite straight-forward...).
This does not only solve the robotleg for me, but also prevents bind-
collisions and unforeseen behavior due to scope 'collisions'. Example:
some modules working fine using an unscoped Jit-bound instance; after
mixing with other modules that make an explicit, Singleton scoped
binding, these modules might behave 'strange'. Such errors are not
easy to track...


I'd like to attach some sources here... but can't see how to do this.

Bye,
Oli

Bob Lee

unread,
Mar 17, 2008, 8:51:52 PM3/17/08
to google...@googlegroups.com
Thanks, Oli. We're planning on using interceptor chaining in the next release.

Bob

Bob Lee

unread,
Apr 2, 2008, 12:45:22 AM4/2/08
to google...@googlegroups.com
I mean "injector" chaining.

Bob

Reply all
Reply to author
Forward
0 new messages