jQuery in Action, 2nd edition*
The moose likes OO, Patterns, UML and Refactoring and the fly likes * Welcome Dhanji Prasanna Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "* Welcome Dhanji Prasanna" Watch "* Welcome Dhanji Prasanna" New topic
Author

* Welcome Dhanji Prasanna

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

This week, we're delighted to have Dhanji Prasanna helping to answer questions about the new book Dependency Injection. See the table of contents online.

The promotion starts Tuesday, September 1st 2009 and will end on Friday, September 4th 2009.

We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Manning.

Please see the Book Promotion page to ensure your best chances at winning!

Posts in this welcome thread are not eligible for the drawing.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Vijay Kumar koganti
Ranch Hand

Joined: Jan 23, 2006
Posts: 53
Hi Prasanna,

why is that Dependency Injection has got such a coverage in the technical circles and what do you think is the main driving factor behind it and ofcourse why should i buy a book dedicated solely for this topic alone ?

regards,
vijay


vijay kumar k.
mark benz
Greenhorn

Joined: Aug 18, 2009
Posts: 15
Welcome Dhanji Prasanna, looking forward to read your book.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Welcome to Javaranch,

Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Dinesh Sundrani
Ranch Hand

Joined: Mar 21, 2006
Posts: 78
All the Ranchers welcoming you to discuss more about your book. Welcome!
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
Hi everyone,

Thanks for the welcome! I look forward to it.

@vijay

DI is becoming a mainstay for all Java development these days. The initial impetus behind DI was to facilitate testing, it is easy to replace dependencies with mock counterparts for example. Then as frameworks began to evolve we found that it had a phenomenal use in reducing repetitive, boilerplate code (such as factories) and even made life easier for other design patterns like the builder and decorator (via AOP for example).

My book is mostly a software engineering, design patterns and best practices book. DI is the prism through which I present all of these concepts, as it helps in designing and understanding application architecture in general. These days you don't start coding a largish application without some form of DI or modularity, and my book investigates the recent learnings behind this using Spring and Guice as palettes.

Dhanji.


Software Engineer at Google

http://twitter.com/dhanji
Richa Tiwari
Greenhorn

Joined: Aug 27, 2009
Posts: 1
Welcome to Java Ranch
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

Welcome to JavaRanch, Dhanji Prasanna


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Welcome Dhanji, it's nice to meet you.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Vamsi Mohan
Ranch Hand

Joined: Jun 20, 2009
Posts: 80
HI, All the Java Ranchers welcoming you to discuss more about your book.

Hearty Welcome!


VAMSI MOHAN.V
(SCJP5.0, IBM Rational Solution Designer, IBM Rational Architect, IBM RUP Designer)
Thamayanthi Guhan
Greenhorn

Joined: Feb 09, 2009
Posts: 8
Hi,

dependeing ijection concept heard through only spring. Is that any other framwork using that concept?. Is that explined in this book?. Most of the time, if we go though the framework which used this concepts will explain what are exists in that but not basic technical details about dependency injection and why it came? how it diffenent? etc.

Is all thosie are covered?

Thanks
Thamayanthi
nibla jose
Greenhorn

Joined: May 25, 2009
Posts: 28
Hello,

How correct is the name 'dependency injection'? I have heard the term IOC also. How much would you support the term 'dependency injection'?
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
@Nibla

The name came from an article written by Martin Fowler. Some people consider the term IoC (Inversion of Control) interchangeable with DI. Some people consider DI to be one form of IoC, etc. I stick with Dependency Injection as it is clear and descriptive of the design pattern in common use today.

@Thamayanthi

Yes, absolutely! At Google (where I work) we use a different framework known as Guice (pronounced "juice"). I explain both and some other alternatives in my book, and describe the basics of the technology without speaking specifically about frameworks. Check out the green paper pdf (free download) at http://manning.com/prasanna for more details.
Bushra Binte
Ranch Hand

Joined: Nov 07, 2006
Posts: 60
Hi,

could you please let me know what is DI in layman's terms.And how is IOC differnect from DI.Thanks
Pawel Luba
Greenhorn

Joined: Mar 04, 2009
Posts: 4
Hello there!
I'm waiting for your book Dhanji
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
@Butool

Hello, Dependency Injection is a design pattern where instead of creating factories or managing the services needed by your objects, you simply use them and allow them to come to you.

This is typically achieved by some bit of code that connects all the "dots" when your application starts up. These days this is done by a library like Guice (http://code.google.com/p/google-guice ) or Spring. Using a library lets you save on a lot of repetitive boilerplate code, and also makes code easy to change, test and maintain. There are also other advantages as you become more sophisticated in its use. I recommend reading the green paper linked elsewhere on this thread.

@Pawel

Thanks! Hope you find it useful.

Dhanji
Johan Pelgrim
Ranch Hand

Joined: Jul 07, 2003
Posts: 105

Hi Dhanji

Does your book cover JSR 330 (Dependency Injection for Java)? http://jcp.org/en/jsr/detail?id=330

And what about the more web related JSR 299 (Web Beans)? http://jcp.org/en/jsr/detail?id=299

Cheers,

Johan



Johan Pelgrim, The Netherlands
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
Hello Johan,

JSR-330 is an effort between my company (Google), SpringSource and Red Hat (among several other prominent technologists) to define a DI standard for Java SE. It is roughly a cherry pick of some of the common (and tried and true) features of Guice, Spring, Web Beans, et al. In my book I explore both frameworks in great detail, so any examination of JSR-330 would just be a lighter description of what is already there.

Having said that if I had had more time I probably would have put something in (we went to copy edit when JSR-330 was submitted). I do not deal specifically with Web Beans as that has evolved over time to include DI and thus did not register on my radar early in the writing process. I believe JSR-299 (no longer called Web Beans) will be based strongly on JSR-330 and offer EE-specific extensions. So it too, is an emerging technology.

Dhanji.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41626
    
  55
@Everyone,
please be aware that questions asked in this thread are not eligible to win a copy of the book, as Jeanne mentioned in the first post.

Last year the JavaRanch Journal published an article by Dhanji entitled Dependency Injection - What is Scope? which is an excerpt from the book.


Ping & DNS - my free Android networking tools app
Johan Pelgrim
Ranch Hand

Joined: Jul 07, 2003
Posts: 105

Thanks Dhanji!
Acharya Thiyagarajan
Greenhorn

Joined: Aug 01, 2009
Posts: 18
Hi Dhanji,

In struts and in normal java the general way of biniding the port for eg 8080 is by using properties. When we need to change in guice and properties we need to take a new build and deploy. all the configurable properties are all in a property file and will inturn be a jar which is deployed. Constants are past tense. How is guice better?

Second question I have is in your presentation I see in many places that during bootstrap. hence does it mean that there are these dynamic bindgs that happen during startup of server which in turn increases my deployment time?

Also how to bring in DI to an existing Struts application?
Regards,
Acharya
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Dhanji, my impression and based of a number of articles, is that DI is a form, of inversion of control. Is this how you see it too? Even thjough in some articles I have seen DI and IOC used interchangably.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
Hi, yes some people believe that, some use them interchangeably. I avoid the term IoC altogether as I've head people describe as diverse things as EJB with that term. I prefer DI as it is specific to the topic at hand and particularly with the Guice and Spring libraries (and the upcoming JSR-330 effort).
Anoop Saharan
Greenhorn

Joined: Aug 31, 2009
Posts: 1
Look forward to reading your book. Thanks, Anoop
Michael Peremsky
Greenhorn

Joined: Nov 07, 2008
Posts: 10
Welcome, I look forward to reading your book, it certainly sound sinteresting.
zahid zubair
Ranch Hand

Joined: Aug 29, 2009
Posts: 32
Welcome Prasanna. I would be pleased to read such a kind of book in future. I do not have any questions as I have not heard much of it.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Ulf Dittmer wrote:
Last year the JavaRanch Journal published an article by Dhanji entitled Dependency Injection - What is Scope? which is an excerpt from the book.


Thanks Ulf,

for your sharing.. this journal.. a great resource, indeed

Vijay Kumar koganti
Ranch Hand

Joined: Jan 23, 2006
Posts: 53
Dhanji Prasanna wrote:
My book is mostly a software engineering, design patterns and best practices book. DI is the prism through which I present all of these concepts, as it helps in designing and understanding application architecture in general. These days you don't start coding a largish application without some form of DI or modularity, and my book investigates the recent learnings behind this using Spring and Guice as palettes.

Dhanji.



Looking forward to read it ..Would be happy if you can generously give me a free copy.

vijay
Mark Nibert
Ranch Hand

Joined: Jul 01, 2009
Posts: 42
Hello and welcome to the ranch. I am new at this myself and I am reading about your book now.
Sandeep Awasthi
Ranch Hand

Joined: Oct 23, 2003
Posts: 597
Welcome Dhanji Prasanna.


Sandeep
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Vijay Kumar koganti wrote:
Looking forward to read it ..Would be happy if you can generously give me a free copy.

vijay


find how you become eligible to win free copy.
Jess LeMar
Greenhorn

Joined: Apr 03, 2009
Posts: 6
Hi Dhanji,

I watched the video about DI at the Guice homepage. I am fairly new the DI and have used it sparsely in app servers.

What is the relationship between DI and Java Service Providers? It seems to me that the Service Providers could be used as way to load the desired modules and keep the brains the code base very dumb Furthermore, is Java Service Providers incorporated into any DI frameworks that you know of?

Thanks for your time.
Jess
Dhanji Prasanna
author
Ranch Hand

Joined: Aug 30, 2009
Posts: 38
Hi Jess,

Yea that is a common question. The green paper pdf compares and explored the differences between the service locator model and DI:
http://manning.com/prasanna

As for DI support, if you mean JNDI support then both Spring and Guice do this out of the box.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

All: Remember to participate in threads other than this one if you wish to be eligible to win.
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
Hi Dhanji,

Would you say that by implementing DI, Agile development with Java technologies would be a lot better? Will it dramatically affect the usual best practices in average software development environment that we have today? Thanks in advance, I'd really like to learn about it.

Regards,

Lorenz


I just cant look, its killing me.
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 449

Welcome Dhanji, would be fun to read your book. Thanks.


http://muhammadkhojaye.blogspot.com/
Sampath Abeysinghe
Greenhorn

Joined: Feb 13, 2008
Posts: 4
As I'm studying for SCBCD exam, I find huge amount of DI involved in new EJB3.0 Session Beans and MDBs. So I like to learn the ins and outs of DI as it will important for the exam.
I've read some books on EJB3.0. But the problem is lack of *exam oriented* materials. I suppose your book will help me.


WMSK Abeysinghe
(SCWCD 5.0)
ContactAnirban Bhattacharjee
Greenhorn

Joined: Mar 31, 2009
Posts: 7
Hello Dhanji,
I am based in Japan. And here SEASAR is pretty popular as a DI framework. And as you know DI is convenient so everyone is going for it. There are numerous frameworks and technologies in which DI is an integral part. For example Spring, EJB....In your book is there any analysis of the contemporary frameworks which are eanbling application developers to use DI through it.

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

あにるばん ばったちゃじ wrote:Hello Dhanji,
I am based in Japan. And here SEASAR is pretty popular as a DI framework. And as you know DI is convenient so everyone is going for it. There are numerous frameworks and technologies in which DI is an integral part. For example Spring, EJB....In your book is there any analysis of the contemporary frameworks which are eanbling application developers to use DI through it.


To the previous poster - please change your display name to something that renders using an English alphabet. I can't read what you wrote, so I assume it is in Japanese.
Acharya Thiyagarajan
Greenhorn

Joined: Aug 01, 2009
Posts: 18
Hi Dhanji,

In struts and in normal java the general way of biniding the port for eg 8080 is by using properties. When we need to change in guice and properties we need to take a new build and deploy. all the configurable properties are all in a property file and will inturn be a jar which is deployed. Constants are past tense. How is guice better?

Second question I have is in your presentation I see in many places that during bootstrap. hence does it mean that there are these dynamic bindgs that happen during startup of server which in turn increases my deployment time?

Also how to bring in DI to an existing Struts application?
Regards,
Acharya
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: * Welcome Dhanji Prasanna