The Android framework provides a lot of flexibility in deciding how to organize and architect an Android app. While this freedom is very valuable, it can also lead to apps with large classes, inconsistent naming schemes, as well as mismatching or missing architectures. These types of issues can make testing, maintaining and extending your apps difficult.
The Android Architecture Blueprints project demonstrates strategies to help solve or avoid these common problems. This project implements the same app using different architectural concepts and tools.
You can use the samples in this project as a learning reference, or as a starting point for creating your own apps. The focus of this project is on demonstrating how to structure your code, design your architecture, and the eventual impact of adopting these patterns on testing and maintaining your app. You can use the techniques demonstrated here in many different ways to build apps. Your own particular priorities will impact how you implement the concepts in these projects, so you should not consider these samples to be canonical examples. To ensure the focus is kept on the aims described above, the app uses a simple UI.
요즘 부서에서 Android MVP 가 핫한 이슈가 되어 Android Architecture Blueprints 를 들여다 보게 되었습니다.
Stable samples – Java
|todo‑mvp||Demonstrates a basic Model‑View‑Presenter (MVP) architecture and provides a foundation on which the other samples are built. This sample also acts as a reference point for comparing and contrasting the other samples in this project.|
|todo‑mvp‑clean||Uses concepts from Clean Architecture.|
|todo‑mvp‑dagger||Uses Dagger 2 to add support for dependency injection.|
|todo‑mvp‑rxjava||Uses RxJava 2 to implement concurrency, and abstract the data layer.|
|todo‑mvvm‑databinding||Based on the todo-databinding sample, this version incorporates the Model‑View‑ViewModelpattern.|
|todo‑mvvm‑live||Uses ViewModels and LiveData from Architecture Components and the Data Binding library with an MVVM architecture.|
제일 먼저 todo-mvp 를 들여다 보았습니다.
Basic Model-View-Presenter architecture 라고 하는데 이게 좋은 architecture 인지는 잘 모르겠습니다.
구조에 맞게 분리는 해놓았습니다만, 동작 흐름을 살펴보면 View (Fragment) 를 통해서 Presenter 가 동작하고, Presenter 는 내부에서 View 를 조작하고.. 이렇게 View 와 Presenter 간에 순환하는 방식 같습니다.
위의 글에는 MVP 에 대해 잘 설명되어 있습니다만, 개인적으로는 Android 에서 MVP 가 잘 맞는지 의문입니다. 아직 답은 찾지 못했습니다.