• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

* Welcome Dhanji Prasanna

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome Dhanji Prasanna, looking forward to read your book.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Javaranch,
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the Ranchers welcoming you to discuss more about your book. Welcome!
 
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to Java Ranch
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Dhanji Prasanna
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome Dhanji, it's nice to meet you.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI, All the Java Ranchers welcoming you to discuss more about your book.

Hearty Welcome!
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

could you please let me know what is DI in layman's terms.And how is IOC differnect from DI.Thanks
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there!
I'm waiting for your book Dhanji
 
Dhanji Prasanna
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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
 
Ranch Hand
Posts: 105
Android Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Dhanji Prasanna
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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.
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dhanji!
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Dhanji Prasanna
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look forward to reading your book. Thanks, Anoop
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome, I look forward to reading your book, it certainly sound sinteresting.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello and welcome to the ranch. I am new at this myself and I am reading about your book now.
 
Ranch Hand
Posts: 597
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome Dhanji Prasanna.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All: Remember to participate in threads other than this one if you wish to be eligible to win.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 449
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome Dhanji, would be fun to read your book. Thanks.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

あにるばん ばったちゃじ 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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic