How to choose Android Design Pattern
In this article , I want to focus which architecture is suitable in which kind of Android App. MVC, MVP, MVVM all of these designs are dealing for the different layers to segregate the responsibility for each individual layer but these differs with one major aspects how much the individual layer is loosely coupled which can be compiled independently and hence can be tested independently.
Why MVVM is majorly used Architecture in Android Apps:
1.) Those Components need data from network API that is suitable use case for data driven architecture.
2.) Showing States for loading , error , file download, file upload, Processing Data, all kind of these use cases will require UI update which can be reactive easily by using MVVM.
3.) Every layer will be loosely coupled Which will help us to inject dependencies through interfaces and will be helpful to add new functionalities or features without breaking SOLID principles.
4.) MVVM will benefit us with separation of concern Principle which will be helpful for writing the test cases independently for each layer.
5.) Handling UI data due to device rotation and Handling memory for unused resources for different UI lifecycle events is supported in MVVM out of the box.
So based on the use case developers can choose the correct design pattern which will increase the code reusability and scalability.
Thanks for reading it.