# Simplifying State Management with Compose

DevFeed: [Simplifying State Management with Compose](<https://devfeed.tech/articles/simplifying-state-management-with-compose-20043.md>)

Original publisher: [Read original article](<https://technology.doximity.com/articles/simplifying-state-management-with-compose>)

Author: Doximity

Published: 2023-07-05T19:45:00Z

Content type: tutorial

Language: en

Sources: [Doximity](<https://devfeed.tech/sources/doximity.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Android](<https://devfeed.tech/topics/android.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Development](<https://devfeed.tech/topics/development.md>), [interoperability](<https://devfeed.tech/topics/interoperability.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [clean-architecture](<https://devfeed.tech/tags/clean-architecture.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [interoperability](<https://devfeed.tech/tags/interoperability.md>), [state](<https://devfeed.tech/tags/state.md>), [state-management](<https://devfeed.tech/tags/state-management.md>), [xml](<https://devfeed.tech/tags/xml.md>)

## AI overview

This tutorial explains how Doximity's Android team experimented with using the Compose Runtime instead of ViewModels to manage screen state in the refreshed Amion physician scheduling tool. It describes the related presentation-layer and clean-architecture patterns, including interoperability with existing XML and Compose UI, and introduces foundations for a follow-up note-taking app.

## Source excerpt

The recent release of Doximity's refreshed physician scheduling tool Amion involved a significant overhaul of the user interface (UI) layer using Jetpack Compose. As part of the development process, we decided to experiment with shifting from ViewModels to utilizing the Compose Runtime for managing screen state. This article explores the motivations behind this approach and demonstrates an overall improvement to the view layer and presentation logic using the patterns developed in Amion 6.0.0. Note: This is part one of a two-part article. In part two, we will build a note-taking app using the foundations covered here. Understanding the Presentation Layer The Android team at Doximity builds apps following the basic principles of clean architecture, which involves separating the app into layers, each with their own responsibilities. In our app, we have a view layer, responsible for rendering UI components (Compose UI, XML views, etc.), and a presentation logic layer, responsible for producing screen state. Every navigable point in the app corresponds to one or more UI components and is associated with one or more screen state producers. Inspiration and Initial Experiments The decision to leverage Compose for managing state was inspired by (at the risk of sounding like r/mAndroidDev) Jake Wharton's article The State of Managing State (with Compose). While the release of Circuit occurred midway through our development, it was deemed more of a framework that required significant buy-in, whereas we aimed to build a flexible pattern with smoother interoperability with our existing architecture, that at the time mostly utilized ViewModel with XML and Compose UI. When we think about the presentation layer in Android as developers, we have to think about: What is the state of the screen? That is, not just when the user first sees it, but what does it look like when it's loading, what happens when there is an error, how will the state of components of the screen interact, and