Dagger 2 - A New Type of Dependency Injection

Gregory Kick gives us a quick run-down of Java dependency injection solutions and how Dagger 2 overcomes their shortcomings.

##A Quick Overview of Dependency Injection [01:49]

Greg uses a familiar example, the coffee maker, to illustrate the concept of dependency injection. He will use this throughout the presentation and update the implementation as he introduces each DI library.

##The Problem with Dependency Injection [04:34]

Dependency injection requires the programmer to write thousands of lines of code. The challenge is how to get the benefits while avoiding the boilerplate.

##Solution #1 - Spring [05:59]

He talks about Spring and how it basically does the job. A number of issues were pointed out such as verbosity because of its use of XML, runtime validations, untraceable app flow and the map-like API.

##Solution #2 - Guice [09:14]

Guice eliminated the use of XML and replaced it with annotations and introduced dynamism. However, reflection is still around, app flow is still not traceable, and the map-like API still exists.

##Solution #3 - Dagger 1 [18:05]

The guys at Square produced Dagger 1 to take on the problem. They reduced reflection, moved configuration processing to compile-time and improved traceability by allowing the programmer to peek at generated code.

##Solution #4 - Dagger 2 [24:21]

Knowing the success of Dagger 1, Dagger 2 kept its predecessors API. Greg walks us through the most important parts of Dagger 2, providers and components, while explaining how reflection was eliminated, how debugging was made better and how the map-like API was dumped.

##The Status of Dagger 2 [38:15]

Greg gives the current status of Dagger 2 and expects the support from the community.

*****
Written by Al John Quiapon on 05 January 2016
*****