Re: [ANN] WOInject 1.0
Re: [ANN] WOInject 1.0
- Subject: Re: [ANN] WOInject 1.0
- From: "Ricardo J. Parada" <email@hidden>
- Date: Tue, 10 Apr 2012 13:07:41 -0400
Thanks a lot for taking the time to explain it. That helps quite a bit.
Ricardo
On Apr 7, 2012, at 11:07 PM, Henrique Prange wrote:
> Hi Ricardo,
>
> WOInject is a framework that enables dependency injection in WebObjects applications by integrating the Guice framework.
>
> OK. It doesn't help much. :) I'm not sure about the level of knowledge you have about DI or Guice. So, here is a list of the topics you should know to understand what WOInject can do for you. You can skip the topics you are already familiar with.
>
> 1) What is dependency injection?
>
> You can learn the theory behind dependency injection and inversion of control containers in the Martin Fowler article [1] about the subject.
>
> 2) What is Guice?
>
> I think the Motivation page [2] on the Guice's User Guide is the best place to start understanding the basic problems, and the solutions proposed by Guice.
>
> 3) What is WOInject?
>
> WOInject is just a framework to integrate Guice with WebObjects in a non-intrusive manner. So, what Guice can do for you?
>
> Suppose you have a Service interface and a BasicService implementation for it. This Service is required across your components. So you have something like this:
>
> class ComponentOne {
> Service service = new BasicService();
> }
>
> class ComponentTwo {
> Service service = new BasicService();
> }
>
> ...
>
> Then, the project evolves, and you develop a new AdvancedService implementation for the Service interface. You have to traverse the entire code base updating the instantiation of Service.
>
> On the other hand, if you use Guice, you can delegate the creation of Services to Guice, and inject the instances of Service when required. You write code like this:
>
> class ComponentOne {
> @Inject
> Service service;
> }
>
> class ComponentTwo {
> @Inject
> Service service;
> }
>
> ...
>
> And you configure a Guice Module to specify that you want an instance of BasicService (or an AdvancedService) when you need a Service.
>
> class AppModule extends AbstractModule {
> void configure() {
> bind(Service.class).to(BasicService.class);
> }
> }
>
> If you need to change the implementation class, you just have to redefine your module:
>
> class AppModule extends AbstractModule {
> void configure() {
> bind(Service.class).to(AdvancedService.class);
> }
> }
>
> This is a basic example of what Guice (and dependency injection) can do for you. Real-world problems are much more complex. A Service implementation may require a Connection that needs a URL and Credentials to work. Guice can handle the entire hierarchy of dependencies for you.
>
> Of course, Guice can do a lot more for you. I'm still preparing a few use cases for the WOInject's User Guide to demonstrate situations where dependency injection is helpful and other Guice's features that make it so powerful.
>
> [1]http://martinfowler.com/articles/injection.html
> [2]http://code.google.com/p/google-guice/wiki/Motivation
>
> Cheers,
>
> Henrique
>
> On 05/04/2012, at 16:17, Ricardo J. Parada wrote:
>
>>
>>
>> Is there a short explanation of what it does? Can it be explained with a code snippet or in a paragraph?
>> I still don't quite understand the concept. :-)
>>
>>
>>
>>
>> On Apr 4, 2012, at 1:11 PM, Henrique Prange wrote:
>>
>>> Hi Paul,
>>>
>>> Don't get me wrong. I really appreciate the interest in WOInject. It is an honor for me to talk on WOWODC again. I'm working hard here to make it happen. However, I'm still not sure if I'll be able to afford the trip to Canada. :( So, I don't want to create expectations for something I may not be able to deliver.
>>>
>>> Cheers,
>>>
>>> Henrique
>>>
>>> On 04/04/2012, at 02:02, Paul Hoadley wrote:
>>>
>>>> On 15/03/2012, at 5:04 PM, Johann Werner wrote:
>>>>
>>>>> Am 15.03.2012 um 07:12 schrieb ISHIMOTO Ken:
>>>>>
>>>>>> Would be nice to see that at WOWODC in Action.
>>>>>
>>>>> +1
>>>>
>>>> Hey, Henrique, I didn't see a response to this—any chance you'll be at WOWODC 12 and in the mood for a talk/demo/workshop on WOInject? Even informally?
>>>>
>>>>
>>>> --
>>>> Paul.
>>>>
>>>> http://logicsquad.net/
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden