Desktop scoping and lifecycles

2013-09-03 Thread jon . mithe
Hi, Guice has had a big impact with the things I code, particular in developing and bringing together a modular system + then the testing that goes with it. However, I am struggling to find a nice way to do reusable components and in part is due to my inexperience with all of this. Examples of

Re: Desktop scoping and lifecycles

2013-09-03 Thread Sam Berlin
It is usually hard to manage scopes that aren't dependent on threads. Non thread-based scopes usually require a "only one context is active at a time" mode, and you can just switch between the contexts. If that applies to you, then that's doable -- you'll just need some static external state some

Re: Desktop scoping and lifecycles

2013-09-03 Thread Nate Bauernfeind
In this kind of situation I would try to put my non-reusable code behind [well-thought] interfaces as much as possible. Think about all the [known] use-cases and really try and separate the common logic from the custom logic. If you can hide the state behind a logical interface that has always been

Re: Desktop scoping and lifecycles

2013-09-04 Thread jon . mithe
Yeah definitely not a thread based scope. I'm thinking with the complexity the scope becomes a little difficulty to manage / some magic with child injectors may be better. Thanks. On Tuesday, September 3, 2013 6:55:59 PM UTC+1, Sam Berlin wrote: > > It is usually hard to manage scopes that aren

Re: Desktop scoping and lifecycles

2013-09-04 Thread jon . mithe
Thanks. Yeah that makes sense, I don't mind adding guice functionality or utilities if it simplifies the actual end code I write. What I want to avoid is writing some code then having to write more custom code just to get it bound properly and reusable. Seems that is what you have achieved w

Re: Desktop scoping and lifecycles

2013-09-05 Thread Jordi Gerona
maybe you can try to use Onami Lifecycle Dispose support [1] or Lifecycle Management in Governator [2] hth, jordi [1] http://onami.apache.org/lifecycle/org.apache.onami.lifecycle.standard/dispose.html [2] https://github.com/Netflix/governator/wiki/Lifecycle-Management On Wed, Sep 4, 2013 at 7:0