DAGGER 2 - A New Type of dependency injection





The interactive transcript could not be loaded.



Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on Aug 21, 2014

The best classes in any Java application are the ones that do stuff,
e.g., the BarcodeDecoder, the KoopaPhysicsEngine, the AudioStreamer, etc. These classes all have dependencies; perhaps a BarcodeCameraFinder, DefaultPhysicsEngine, and an HttpStreamer. In contrast, the worst classes in any application are the ones that take up space without doing much at all, e.g., the BarcodeDecoderFactory, the CameraServiceLoader, and the MutableContextWrapper. These classes are the clumsy duct tape that wires the interesting stuff together.

Dagger is a very fast and simple replacement for these FactoryFactory
classes. It allows you to focus on the interesting classes. You just simply declare dependencies, specify how to satisfy them, and ship your app.

Dagger is a joint effort between Google and Square with some individual contributors from other places such as Netflix. It is descended conceptually from another project used widely within Google called Guice, which despite its popularity was not without issues.

This is the story of another small group of engineers attempting to evolve and improve DI forward yet again with Dagger: a dramatically different reimplementation using generated code.


When autoplay is enabled, a suggested video will automatically play next.

Up next

to add this to Watch Later

Add to

Loading playlists...