I'm about to start a relatively big project and was wondering
What are the real benefits of using these dependency injection frameworks?
Does DI increase app load times? Or offer any performance value?
Googles documentation goes against using Robojuice because of its RAM usage, is this something common across all DI's?
Interested to hear everybody's opinion.
Benefits of using Dagger Dagger frees you from writing tedious and error-prone boilerplate code by: Generating the AppContainer code (application graph) that you manually implemented in the manual DI section. Creating factories for the classes available in the application graph.
Reduces the boilerplate code. Makes our code reusable and clean. Makes it easy to replace our dependencies with fake implementations which make testing easier. Helps us enable loose coupling.
The term dependency injection context is typically used to describe the set of objects which can be injected. In Dagger 2, classes annotated with @Module are responsible for providing objects which can be injected. Such classes can define methods annotated with @Provides .
Dagger 2 is a compile-time android dependency injection framework that uses Java Specification Request 330 and Annotations. Some of the basic annotations that are used in dagger 2 are: @Module This annotation is used over the class which is used to construct objects and provide the dependencies.
I work for NYTimes and it takes less than 100ms to instantiate hundreds of managed objects across 2 scopes using Dagger 2. Dagger helps us organize objects and remove a lot of boilerplate from activities or business objects. I would recommend it for any size app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With