Dagger 2.13 released with android support module and android compiler. I think this was a huge change for us and all android developers should switch to new dagger android injection as soon as possible.
class •Let say we update the Email’s constructor •Let decide to add different message delivery systems such as SMS , Tweets, …… •Testing the application will be very difficult SOME LIMITATIONS 6
11 class Person { fun greetFriend(subject : String, message: String) { val mService = Factory().messageServiceDependency mService.sendMessage(subject,message) } } FACTORY WAY
Is Very Slow And Time Consuming ▪ Perfom Dependencies Resolution At Runtime ▪ Leads Unexpected Errors ▪ Crashes The Application ◦Pre-Compiler ▪ Uses Android Processor ▪ Creates All Objects Using Ap DEPENDENCY INJECTION 14
• @Module : Classes Which Methods “Provide Dependencies” • @Provides : Methods Inside @Module, Which “Tell Dagger How We Want To Build And Present A Dependency“ • @Component : Bridge Between Modules And Injections • @Scope : Enables To Create Global And Local Singletons • @Qualifier : If Different Objects Of The Same Type Are Necessary DAGGER 2 API? 18
BOILER PLATE CODE • MAKE THE DEVELOPMENT PROCESS SMOOTH • EASILY TESTABLE CODE • CODE REUSABILITY • SIMPLE UNIT TESTING AND INTEGRATION TESTING • NO OBFUSCATION PROBLEMS • SMALL SIZE OF THE LIBRARY • 43