From: Marc P. <ma...@an...> - 2005-07-23 08:54:06
|
Nikhil G. Daddikar wrote: > Is there is a better way to get access to singletons? I access > singletons as $Singleton() which is mapped to the getInstance static > method. What I don't want to do is write context tools for each of these > or put("singleton", Singleton.getInstance()) in the context. I strongly suggest, if you can, that you move away from singletons as they are a problem for refactoring and later changes to code - except in rare cases. Look at Spring IoC if you haven't... you could use a Spring bean context to gather all your system components (even singletons) into a single bean context, and just put that bean context into the WM context - no 100% pretty yet, but this has made me think that a ContextTool for exposing a Spring BeanContext would be an -excellent- addition to WM. So, I will do it along with the new Spring MVC code and JSP taglib commits. Shall we push 2.0 out now Lane? Keats' function fix can go in 2.1 along with the JSP and Spring bits. Cheers (BTW Lane - Am using WordPress - yes PHP driven - for small customer websites now) -- Marc Palmer Managing Director, AnyWare Ltd. |