Android has huge gaps but fortunately these are filled up by awesome open source community, now Android development has been a lot easier. Designing an awesome elegant UI is now much easier as we got all the tools needed.
Let’s start with a wonderful dependency injection library called Dagger.
Dagger
Dagger is unlike other dependency injections that generates code on the fly and make your application slower. It has less functionality as compared to Robo Juice but the unfortunate thing with Robo Juice is that it generates the code on the fly that causes slow start up and makes your app more error prone as code is generated on the fly. The best thing with Dagger is that it generates your code on compile time and the generated code is also debug able. Well let’s focus our talk towards Dagger.
The best classes are those who do business, so dagger is a replacement for all those factories of factory classes and helps you to focus on your classes that interest to your business. Dagger is built on JSR-330 annotation standard. Classes are easy to test without much boilerplate code, it’s much easier to test your Dagger modules with other frameworks available for Android.
Dagger is all about creating inject able independent, reusable and interchangeable modules that can be shared among your other applications. There are few things that you cannot do with Dagger.
Read also: Google releases Android 5.0 Developer Kit
@Inject doesn’t work everywhere:
- Interfaces can’t be constructed.
- Third-party classes can’t be annotated.
- Configurable objects must be configured!