Recently I came across ‘ Dependency Injection’ (DI) which is a well-known design pattern in software development/testing framework. James Shore in his article Dependency Injection Demystified says, “Dependency Injection” is a 25-dollar term for a 5-cent concept. But the devil is in the implementation. For android like framework, interaction between the objects are far complex and heavily dependent. The libraries such as Dagger by Square, Butter Knife by Jake Wharton, and AndroidAnnotations provides a means of dependency injection. In these libraries, dagger is famous among android developers/testers.
Following blog posts helps to understand DI. There are few example code that provides enough push to start with dagger.
- In the first part author goes to a base level to understand why DI is used.
- The second part explains briefly on implementation. Good thing is author has a code example in github repository.
- Well thought and written blog post on dependency injection for android.
- leftshift is a Pune, India based mobile app development company and its blog provides real-time scenario where Dagger has helped them to test their apps effectively.
- Good source of motivation if DI or dagger seems a weird word.
- Only provides brief explanation on dagger.
- This guy is from The Big Nerd Ranch guide.
- Provides explanation on run time vs compile time annotation processing.
- It’s a good read for analysis part, but not for implementation.
- This article is old but till date the most cited for DI.
- Provides solid fundamentals on the need of DI for Java.
- Again, it’s a good read for understanding the scenarios where DI is necessary.
- Don’t concentrate on outdated DI frameworks cited in the article. But surely, crux of the article lies in the UML representation of DI.
Well, all the above blog posts are no doubt excellent sources to understand dependency injection, TheCode Whisperer (J. B. Rainsberger) provides 30 second version to create dependency injection container! That’s something agile proponents can be proud of.