Re: Application scope vs Singleton

2009-05-16 Thread nino martinez wael
you can mock statict classes with power mock , but i'vé come to the konklusion that it is a code smell going that way ioc are much better. -from my htc 2009/5/15, James Carman jcar...@carmanconsulting.com: On Fri, May 15, 2009 at 12:18 PM, alf.redo alfredo.alean...@logobject.ch wrote: Thank

Re: Application scope vs Singleton

2009-05-16 Thread James Carman
On Sat, May 16, 2009 at 2:39 PM, nino martinez wael nino.martinez.w...@gmail.com wrote: you can mock statict classes with power mock , but i'vé come to the konklusion that it is a code smell going that way ioc are much better. Right, I didn't say it was impossible. I said it would be more

Application scope vs Singleton

2009-05-15 Thread Alfredo Aleandri
Hi, I have a doubt about application-scoped objects. What's the pro and cons of setting an object instance into my WebApplication class or define that class as singleton (using a static method to access it) ? Thank you alf

Re: Application scope vs Singleton

2009-05-15 Thread James Carman
On Fri, May 15, 2009 at 9:01 AM, Alfredo Aleandri alfredo.alean...@logobject.ch wrote: Hi, I have a doubt about application-scoped objects. What is your doubt? What's the pro and cons of setting an object instance into my WebApplication class or define that class as singleton (using a static

Re: Application scope vs Singleton

2009-05-15 Thread Jan Torben Heuer
Alfredo Aleandri wrote: I have a doubt about application-scoped objects. What's the pro and cons of setting an object instance into my WebApplication class or define that class as singleton (using a static method to access it) ? Pro: Singletons are easy to use Contra: They make Unit tests

Re: Application scope vs Singleton

2009-05-15 Thread alf.redo
: http://www.nabble.com/Application-scope-vs-Singleton-tp23559402p23562038.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands

Re: Application scope vs Singleton

2009-05-15 Thread Jeremy Thomerson
... -- View this message in context: http://www.nabble.com/Application-scope-vs-Singleton-tp23559402p23562038.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr

Re: Application scope vs Singleton

2009-05-15 Thread James Carman
On Fri, May 15, 2009 at 11:26 AM, Jeremy Thomerson jer...@wickettraining.com wrote: Use injection.  The difference is that there is no way to override the implementation of the static accessor / singleton for testing functionality.  If you instead use an IoC container (Spring / Guice) and

Re: Application scope vs Singleton

2009-05-15 Thread alf.redo
(and not store it in WebApplication). Can be some problems about thread-safety or other issue in one case rather than the other? I'm sorry if this seems to be a stupid question... alf -- View this message in context: http://www.nabble.com/Application-scope-vs-Singleton-tp23559402p23563036.html Sent

Re: Application scope vs Singleton

2009-05-15 Thread James Carman
On Fri, May 15, 2009 at 12:18 PM, alf.redo alfredo.alean...@logobject.ch wrote: Thank you to all for your precious suggestions. My question is not for a real need. Supposing to discard the injection strategy, I would like to know if the cache of an object into my WebApplication class during