theme: apple-basic
layout: intro
highlighter: shiki
lineNumbers: true
¶ Architecture Pattern과 Android App Architecture
App architecture design is an important consideration for ensuring that your apps are robust, testable, and maintainable. Android provides a set of libraries and components to help you put together your app according to best practices.
- MVC by Trygve Reenskaug in 1970s
- MVP by Taligent in 1990s
- MVVM by John Gossman in 2005
ref) http://geekswithblogs.net/dlussier/archive/2009/11/21/136454.aspx
- MVC 패턴에서는 Model과 View가 완전히 분리되므로 Model은 쉽게 테스트 가능
- Controller가 안드로이드에 종속되기 때문에 테스트가 어려워짐
- 안드로이드 특성상 액티비티가 View 표시와 Controller 역할을 같이 수행해야 하기 때문에 두 요소의 결합도가 높아짐
- 많은 코드가 Controller로 모이게 되어 액티비티가 비대해짐
- View와 Model 사이의 데이터 흐름이 사라지고 Presenter가 중간에서 데이터 흐름을 제어
- 인터페이스를 추가로 구현해야 하기 때문에 구현비용이 올라가게 됨
- View와 Presenter가 1:1로 대응해야 하기 때문에, 앱이 커질수록 두 요소의 의존성이 강해지게 됨
- View와 Model 사이에 의존성이 없으며, ViewModel도 View에 의존성을 가지지 않음
- 참조는
View > ViewModel > Model 순으로 단방향으로만 일어남
¶ Android App Architecture
ref) https://developer.android.com/jetpack/guide#recommended-app-arch
¶ Android App Architecture
ref) https://developer.android.com/jetpack/guide#recommended-app-arch
https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html