Re: Deferred Binding, Gin in library/widget ?

2011-03-01 Thread Brian Reilly
I believe you would have to add @Inject annotations to your constructors. If you don't, developers using the framework can always hand-code a factory of some sort (Provider in Guice/GIN) to create instances (the factory gets dependencies injected into it so that it can inject them into the objects

Re: Deferred Binding, Gin in library/widget ?

2011-02-28 Thread Uemit
But in case I use a app-wide URL I still have to inject the URL into my DataSource class right? I could use Field Injection but isn't constructor injection the recommended way to do it ? I think it boils down to the question: What is the best practice if you want to develop a standalone

Re: Deferred Binding, Gin in library/widget ?

2011-02-25 Thread Uemit
@Brian: I agree, after thinking a little bit more about that problem and taking your comments into account I think that deferred binding might not be really suitable for my use case. I also agree that the best approach is to set the datasource in the constructor thus enabling users to use

Re: Deferred Binding, Gin in library/widget ?

2011-02-25 Thread Uemit
Hi Phillipe Thanks for the interesting comments. I am still trying to fully understand dependency injection and sometimes I am not sure that I have ;-) I agree that dependency injection is more powerful and flexible compared to deferred binding. So the three cases you described apply when I

Re: Deferred Binding, Gin in library/widget ?

2011-02-25 Thread Philippe Beaudoin
I haven't really decided whether the url is going to be an application wide resources or if it can be set to different values on an instance base. But does it really make a difference in regards to DI? The difference is that if you provide the url on an instance basis than your creation

Re: Deferred Binding, Gin in library/widget ?

2011-02-24 Thread Uemit
@Brian I see your point but I am not entirely convinced yet that using either GIN/deferred binding might not be beneficial for my use case. Just for the record: I think it makes sense to allow the user to choose the specific datasource implementation at compile time, because once the

Re: Deferred Binding, Gin in library/widget ?

2011-02-24 Thread Brian Reilly
It looks like gwt-log uses deferred binding for optimization to eliminate any logging code that's lower than the configured logging threshold. Personally, I would not use deferred binding for your use case. By accepting a datasource as a constructor parameter, you're set up perfectly for

Re: Deferred Binding, Gin in library/widget ?

2011-02-24 Thread Philippe Beaudoin
Hi Uemit, I like your question and must say that I've personally run quite a few times into the deferred binding vs injection question. My personal take on this is that I always favor injection, unless the binding should be property-dependent. By property-dependent I mean that the binding

Re: Deferred Binding, Gin in library/widget ?

2011-02-22 Thread Brian Reilly
I don't think this is a case where I would think of using either deferred binding or GIN. The API you outlined should work as is for anyone who can write their own datasource. For users who can only provide a URL to the data, they can use your HttpDataSource or a more specific subclass of

Re: Deferred Binding, Gin in library/widget ?

2011-02-21 Thread Uemit
Sorry for the thread bump: So I was thinking a little bit more about this problem. Both GIN and deferred binding respectively allow for customization of the widget's datasource during compile time. With gin I have a litte bit more flexibility (creating factory, singleton, etc)? For my

Deferred Binding, Gin in library/widget ?

2011-02-11 Thread Uemit
Hi everyone I am struggling a little bit with the concept of deferred binding and/or dependency injection in libraries/widgets. I try to come up with the best approach for following problem: I implemented a visualization widget (composite) that takes in some data and displays it. I want to