Hakan Bagci

Delivery Hero, Staff Android Engineer

Talk Title

Composing ViewModels: Breaking ViewModels into smaller self-contained UI models

Room

Lovelace

Date

06.07.2023

Time

13:40 > 40 min

Share

on Twitter

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 are going to introduce self-contained UI models and examine the differences between a UI model and a Jetpack ViewModel. In addition to this, we are going to show how we can have leaner fragments and view models by splitting view models into granular self-contained UI models. Advantages of these UI models will be examined in terms of single responsibility, composability, reusability and testability.

Composable UI model approach 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.

Speaker Bio

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.

Menu