Gabe said:
> Nathan,
> Would you please remind me again why we need configurable scopes
> for tools? Scopes are important but why do they need to be configurable?
> Can you show a concrete example or two of tools where the scope is not
> fixed by the design of the tool but rather should be configurable
> by the application developer?

<sigh>must i repeat myself?</sigh>  :-))
the example i gave previously was regarding the DateTool i submitted.  if
configurable scopes are allowed, it may be beneficial to alter DateTool to
implement ContextTool (or whatever we end up calling that interface).   I
can easily envision a single DateTool class that can function appropriately
according to the scope for which it was designated.  if a developer wished
to use it statically across the application, it would be constructed using
the default constructor and thus reflect the locale of the application.  if,
however, a developer wished to have the tool reflect the locale for a
request, they would designate it as 'request' scope in the toolbox.xml and
the toolbox manager would then use the ContextTool interface to obtain
instances of the tool.

again, i readily concede that examples such as this will probably be the
exception rather than the rule and certainly developers can always extend
tool classes to implement different scope designs, but i believe this is a
nice feature and a more elegant solution to using tools in multiple scopes
than forcing developers to extend a tool they wish to use in a different
scope.

the other reason (and this is perhaps the larger one) i prefer to specify
scope in the configuration file, is that it is more informative that way and
requires less special knowledge.  if scope is only set by the interfaces a
tool implements, one must then look at the source for each tool and know
which interface is for which scope.  so even should supporting
variable-scope tools be voted down, i think it may still be beneficial to
use the config file to confirm the desired scope of tools.

i suppose the last reason i think we should support variable-scope tools is
simply "why not?"  seriously, it would take at least as much work (if not
more) to enforce fixed-scope by design as it took me to implement
configurable scope in my code.  is there a good reason to force scope to be
fixed by design?

Nathan Bubna
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to