On 2/26/07, Konstantin Priblouda <[EMAIL PROTECTED]> wrote:

> Ummmm, strictly speaking, that's still code. ;)

Strictly speaking yes. But it is externalized and
does not impose anything on  used classes.


It imposes something on me, the programmer.

What if I like to use another session impl in the
> same
> > container?
> Use an annotation.

And if I need to register the sme class more than
once?
Yet another annotation? And another one?


Um, yeah. Doesn't Pico need multiple key objects? And to apply those key
objects, don't I have to write external code where I repeat property names,
etc.?

You can override the scope in the configuration. You
> can also implement your
> own scopes and scope annotations. The users' guide
> explains this.

And those scope annotations will leak into my original
code. ( And I prefer my classes to be innocent, and
not
knowing that it is managed by Guice or pico or
whatever
else. Such dependency invalidates whole point of DI /
IoC )


I clearly said, you can specify the scope internally or externally. I like
being able to specify the scope directly on the class because it makes it
clear to someone who is changing the class, and it's more succinct. For
example, based on the annotation, I can clearly see that this class is
session scoped and thus needs to be thread safe.

In Struts 2 for example, I can apply @SessionScoped to an action and that
action will be stored in the session. It doesn't get much simpler than that.

Finally, using a scope annotation in no way ties your class to the scope
implementation.

Bob

Reply via email to