From the course: Android Dependency Injection with Dagger 2 and Kotlin
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Rethinking the graph
From the course: Android Dependency Injection with Dagger 2 and Kotlin
Rethinking the graph
- [Instructor] If you're starting to feel comfortable with subcomponents, congratulations! You are now a Dagger journeyman! As we move on though, here's something I'd like you to think about. Maybe you're slightly baffled by subcomponents. Well, here's a way to think about them that might be useful. Although it's accurate, it can be a little bit confusing. Remember that what Dagger is doing is creating a dependency graph. In this particular graph, dependency goes down the tree. That is, things at the top depend on the things beneath them. They in turn depend on the things beneath them. So let's call this graph a component. Now, imagine that we create a new graph that includes the original graph, like this. What do you think we call the new parts of the graph? Well, if you're Dagger, you call it a subcomponent. Yeah, I realize that a component is a subset of the subcomponent. I also realize that, in this picture, the subcomponent is above the component. Maybe it'll make more sense if…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.