Effective Dependency Injection Scoping

ashdavies ™
AndroidPub
Published in
Apr 10, 2017

The concept of dependency injection is a relatively simple one, and can usually be adhered to with a small set of rules when writing your code.

Specifically, avoid creating new instances of objects within your classes, and opt to have the instance provided through the class constructor. This allows your class to focus on the key operations without having to worry about the state or creation of it’s dependencies.

This means that your class will be small, concise, readable, and most importantly, easily maintainable since it only contains the logic required to perform the necessary operation.

Continue reading…

--

--

ashdavies ™
AndroidPub

Android & Kotlin @GoogleDevExpert , failed blogger, public speaker, maker (and breaker) of shiny things @snappmobile_io (he/him)