Sep 2017
11 Mon
12 Tue 08:30 AM – 05:20 PM IST
13 Wed 08:30 AM – 05:30 PM IST
14 Thu
15 Fri
16 Sat
17 Sun
Garima Jain
We have had many talks and blog posts on Dagger and Dependency Injection till now. I must say that people have done a great job at explaining various concepts of dependency injection, it’s technical details and also case studies. But, in my opinion, Dagger is something which has become a part of our coding lives now. Yet, from time-to-time we still find ourselves lost in the world of dependencies and dealing with “The Dahaka” (a beast of generated code).
In this talk, we will aim to Defeat “The Dahaka” (a storm in the ocean of generated classes) or at least try to tame the beast. We will firstly go over the basics of Dagger2 and try to unleash the beast by going into the generated classes and finding out various patterns. We will then go into the details of those patterns and learn how to apply them. We will then find our way towards the technicalities of Dagger Android. Also how to move towards Dagger Android without blindly applying those annotations and also trying not to die in the hands of “The Dahaka” by putting the leash back on the Beast.
@Module
and a @Component
. Add a @Singleton
scope to it.Qualifiers
, use LazyInjection
,ProviderInjection
, staticInjection
,AsyncInjection
, MultiBinding
and what not!Module
and a Component
?Component
, Dagger generates a DaggerComponent
which has a "has-a
” relationship with our Module
.“Most people think dependency injection is like a river that flows swift and sure in one direction, but I have seen the face of dependencies and I can tell you they are wrong. Dependency Injection is an ocean in a storm. You may wonder who I am and why I say this; sit down and I will tell you a tale like none that you have ever heard!” — Quote inspired from Prince of Persia
In this series of blog posts, we will aim to Defeat “The Dahaka” (a storm in the ocean of generated classes) or at least try to tame the beast. We will firstly go over the basics of Dagger2 and try to unleash the beast by going into the generated classes and finding out various patterns. We will then go into the details of those patterns and learn how to apply them. We will then find our way towards the technicalities of Dagger Android. Also how to move towards Dagger Android without blindly applying those annotations and also trying not to die in the hands of “The Dahaka” by putting the leash back on the Beast.
After reading these series of articles you should get a better sense of what goes on behind the scenes and how to smartly move towards Dagger Android and still keep your cool :)
Here’s how we are going to tame the Beast :
**“Codes of Time” : Introduction **: We already have really great articles about Dagger2 basics. This will be a collection of my favorites references and a quick walkthrough of the basics.
**“Face of the Dahaka” : Definitions **: A sneak peek at the generated code and various Dagger terms and patterns. Let’s swim in the ocean of Factories
MemberInjectors
ProviderInjections
LazyInjections
AsyncInjection
.
**“Unleash the Beast” : Relationships **: A Tale of Scopes
, Components
, Subcomponents
, Dependent Components
and the Builders
.
**“Defeat the Dahaka” : Battle **: Let’s use the tools at hand like Builders
@BindsInstance
Component.Builder
Subcomponent.Builder
DoubleCheck
Multibinding
… in order to tame the beast.
Dagger 2 : Component.Builder
**“Befriend the Beast” : Implementation **: Dagger 2 Android 😎!
Checkout the Series of articles on Medium:
Here’s the very first article “Dagger 2 : Component.Builder”
Here’s the second article “Dagger 2 : Check — SingleCheck — DoubleCheck … Scopes”
Here’s the Main Article : “Dagger 2 Android : Defeat the Dahaka”
I am also giving a similar talk on “Dagger 2 Android : Defeat the Dahaka” at Droidcon Berlin, 2017 😃
Lots of excitement and an open-mind :)
Garima is a computer science post-graduate from IIT Jodhpur and currently working as an Android Developer at Fueled, Noida having an experience of 4 years in Android Development. She is an active community speaker and tech-fi blogger who believes in sharing and learning with the community. Her journey of community sharing started with Droidcon India, 2016 and since then she has posted multiple blog posts on her medium account and spoken at Droidcon Boston, 2017 and taken a workshop at GDG New Delhi. She is also speaking at Droidcon Berlin, 2017.
{{ gettext('Login to leave a comment') }}
{{ gettext('Post a comment…') }}{{ errorMsg }}
{{ gettext('No comments posted yet') }}