[android] Dagger2 tutorial part2 Dependency Injection in Android https://blog.mindorks.com/introduction-to-dagger-2-using-dependency-injection-in-android-part-1-223289c2a01b - Dependency Injection = Inversion of Control - 한 java class 에서 다른 java class 를 new operator 로 생성하면 test 하는 것이 쉽지 않다. 이를 hard dependency 라고 부른다. - Dagger1 은 reflection 을 사용해서 DI 를 수행했었다. 이는 많은 단점을 가지는데, 우선 느리고, 두번째는 작업이 runtime 에서 수행이 되며, 세번째는 예상치 못한 crash .. 2018. 12. 5. [android] Dagger2 for Android Beginners - Dagger 는 static, compile-time dependency injection framework 이다. 기존 버전(1.x)은 Square 에 의해 만들어졌고, 새 버전은 (2.x) Google 에 의해 유지보수되고 있다. - Hard dependency 는.. reusability 를 감소시킨다. testing 을 어렵게 한다. 코드의 scale up 이나 유지보수를 어렵게 한다. - Dependency 에는 다음의 type 이 있다. class, interface ,method/field, direct/indirect - java 에서 new operator 로 instance 를 생성하면, 독립적으로 test 되기가 어렵다. 이를 dependency 라 불린다. - Dependency.. 2018. 12. 3. 반응형 이전 1 다음