Geeks With Blogs
Madhawa Learns To Blog : C#, Java .net, c#, java,sql, OOAD and more mad memory dumps...

Doing some R&D works on GWT a few weeks back, I really fascinated on the Google frameworks. Next Google framework I’m gonna puts my hands on is Guice: Google way of implementing Dependency Injection.  That isn’t a company assignment but I think its worth to learn and try. Guice (pronounced "juice") is an ultra-lightweight, next-generation dependency injection container for Java 5 and later.

If you have ever tried out to achieve loose coupling to the ultimate extent you really should know about dependency injection. It’s not a buzz word anymore. People are using several of methods and frameworks to implement DI. Couple of years back when I was at my good old place (Logical Systems now known as Kandysoft) I did my first application design on my own. It was an e-commerce web site and I got instructions to develop the application framework as generic as possible. So we can re-use some of it functionalities in other applications. Our focus was on product catalog and shopping cart. Some applications product catalog and shopping cart is not separated but I thought it has to be developed as separated. So I did it and it was a very successful one. At that time I actually had heard about DI and use of it to achieve loose coupling. But only article I had read was
Martin fowlers one and I couldn’t understand it much of it at that time. And for the worse case I had limited time frame to complete and deliver the project as we always do. Anyway I gained what I wanted by  using interfaces and now I know I have implemented dependency injection by hand even though I didn’t know  I was doing that.

BTW now there are so many application frameworks that leverage use of DI and some related functionalities. I think spring is in the top. They are hitting both java and .net so it’s a great framework to developers like me who focused on both java and .net.

But if you are new to DI and doing java I think Guice is the best to put your hands on first. Like all Google frameworks it simple and easy to learn. I’ll shed some posts later on DI and Guice.

Posted on Saturday, July 14, 2007 7:54 AM Java , Architecture | Back to top


Comments on this post: Guice: Google way of implementing Dependency Injection aka Inversion of Control

# re: Guice: Google way of implementing Dependency Injection aka Inversion of Control
Requesting Gravatar...
True Madhawa... Seems Guice is very simple but powerfull. If you want to use IoC Guice is more than enough. But Spring is a complete framework eventhough its little heavy.
Left by Mikie Heinsten on Jul 20, 2007 11:17 PM

# re: Guice: Google way of implementing Dependency Injection aka Inversion of Control
Requesting Gravatar...
Machan... there is another framework available for similar purpose. actually its a web framework called Apache Tapestry. It has a built in IOC registry and a lightweight one. I found that it's more simpler than Guice. :)
Left by Lakshitha on Sep 05, 2008 9:34 AM

# re: Guice: Google way of implementing Dependency Injection aka Inversion of Control
Requesting Gravatar...
Thats great machan. I think you gonna use it right?. BTW as you know now again I'm focussed on .net I'm gonna try Unity, the microsoft flavour in IOC. :)
Left by Madhawa on Sep 08, 2008 5:47 AM

Your comment:
 (will show your gravatar)


Copyright © Madhawa Karunaratne | Powered by: GeeksWithBlogs.net