Dagger 2 Rant

Dependency injection is a relatively simple concept. I mean it is basically just providing the dependencies, which are often objects, to a class. The most common form of this is done by passing the needed objects as parameters in the constructor of another object. For the other methods though, you may need an injection framework such as Dagger which you can use to inject dependency directly to a member variable or even a method. But holy balls, was it hard for me to get a good grasp of how to use Dagger 2 in my project. Once I understood it, the concept and framework seems pretty simple, but due to the different methods and versions in Dagger, it took me quite a while to get comfortable enough to use it. Tutorials were all over the place having different ways of doing what was essentially the same thing. Learning it shouldn't be that hard, I see an opportunity in there for someone to create an updated tutorial with good coverage of the things you could do in Dagger especially with the versions 2.11 and up.

Anyways, now that I know how to use it and have applied dependency injection using Dagger, I feel like I took a big step in my android development career.

Comments

Popular Posts