NYIMI Jose (BMB) wrote:

In my view, it's a much better solution to have one object that can be used to locate 
other objects. I call this an
application context object, although I've also seen it termed a "registry" or "application 
toolbox". Any object in the
application needs only to get a reference to the single instance of the context object 
to retrieve the single instances
of any application object. Objects are normally retrieved by name. This context object 
doesn't even need to be a
singleton. For example, it's possible to use the Servlet API to place the context in a 
web application's
ServletContext, or we can bind the context object in JNDI and access it using standard 
application server
functionality. Such approaches don't require code changes to the context object 
itself, just a little bootstrap code.


This sounds a lot like the ServiceLocator pattern.

<http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html>





Erik


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



Reply via email to