Hakan Bagci is an Android Staff Engineer at Delivery Hero, a food delivery company. He started Android development in 2012 and has 17 years of software development experience. He got his PhD degree in Computer Engineering. After leaving academic path, he has become a passionate Mobile Engineer and published 10+ small sized indie mobile games to both Android and iOS platforms.
Composing ViewModels: Breaking ViewModels into smaller self-contained UI models
13:40 > 40 min
In early times of Android development we used to have big activities. All view and business logic were being written in activities. Then fragments were introduced so that activities started to become leaner. Then several architectural patterns have started to appear in the Android scene: MVP, MVVM, MVI, etc. While all these were happening, ViewModel like classes started to get bigger and bigger. They have become the new big activities. However, we haven't often considered splitting view models into manageable self-contained granular ones.
Views are composable and they can be composed to build bigger views. What about introducing smaller ViewModels, namely UI models, and using them to build composable UI models/View Models?
In this talk, we will introduce the micro-feature architecture that leverages granular UI models. We'll demonstrate how this approach enables us to create leaner UI hosts by breaking down view models into smaller, self-contained logical UI models. Moreover, we'll explore the distinctions between a UI model and a Jetpack ViewModel.
We'll delve into the advantages offered by micro-feature architecture, particularly in terms of single responsibility, composability, reusability, and testability.
By the end of the talk, you'll have a comprehensive understanding of how adopting this architecture can significantly enhance your development process and empower you to build high-quality, scalable applications which has highly dynamic contextual screens.
Micro-feature architecture is used in several screens of 2 big apps in production which are now being used by 10M+ users. We will be also sharing our learnings about using this approach in these apps.