Skip to content

AwesomeJim/Dependency-Injection-Practice

Repository files navigation

Dependency Injection

Dependency injection (DI) is a technique widely used in programming and well suited to Android development. By following the principles of DI, you lay the groundwork for a good app architecture.

Implementing dependency injection provides you with the following advantages:

Reusability of code.
Ease of refactoring.
Ease of testing.

I have always seen Dependency injection (DI) with Dagger2 as the big Elephant in the room, I made a decision to address this elephant once and for all. I found it easier starting off with Dagger Implementation in Java, then Dagger in Kotlin and finally the new google recommended DI for Android Hilt in Kotlin

Dagger2 In Java

I found a very useful blog by CodingFlow which gave me a very good lift off, very simple,clear and awesome implementation.

Dagger2 in Kotlin

After grasping the whole concept of Dagger in Java it was time to jump into my favorite train of Kotlin. For Kotlin google have a very awesome documentation and a codelab. I took the codeLab

Hilt Codelabs

To implement hilt I had two approach,

Other Hilt DI - Implementations

About

Dependency Injection Practice

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published