Search code examples
daggerdagger-2

What is the difference between Dagger and Dagger 2.0?


What is the difference between Dagger and Dagger 2.0, and why did Google decide to fork the existing project?


Solution

  • Some quotes from the Dagger 2 presentation

    Issues of Dagger 1:

    • Ugly generated code
    • Runtime graph composition
    • Inefficient graph creation
    • Partial traceability
    • Map-like API

    Dagger 2 solutions:

    • Compile-time validation of the entire graph
    • Easy debugging; entirely concrete call stack for provision and creation
    • Fully traceable
    • POJO API
    • Performance

    Dagger 2 issues:

    • Less flexible
    • No dynamism
    • No automated migration path from Guice