Mental Models of Jetpack Compose #1: State & Programming Models

Generic representation of “mental model”. I don’t really know how to visualize this concept 🤷


  • When the flag checkCheckbox == true, then set a CheckBox to checked
  • When the List<User> changes, then set the ProgressBar to GONE, and set the RecyclerView to VISIBLE.

Programming Models/Paradigm

Imperative programming

Declarative programming

  • In SQL, you don’t write “go to the beginning of the user table, and extract 5 rows”, you just write “fetch 5 items from the user table”.
  • In regular expressions, you don’t write “split the input by ., and then count how many groups are there”, you go to StackOverflow and copy the most upvoted answer on “the rule of digits-dot-digits-dot-digits-dot-digits”, i.e. IP address.
  • And in Android layout (we are talking about xml here), you don’t write “add TextView to LinearLayout, and then add another TextView to that LinearLayout”, you write 2 TextViews surrounded by a LinearLayout.
  • JSON parsing with Moshi’s codegen
  • Data binding
  • And pretty much everything Gradle does




if someone can give me a lesson of how to adult that’d be great thank you

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Ruby AR Migrations —The Basics

Experience in Executing & Maintain High Impact Data Platform from Infra to Software to team

Optimization of OpenGL ES vertex data

Test visualization of normals on Buddha model

Why you should always use Pathlib?

Learnings while benchmarking Java Template Engine with Spring Boot — 2018

First look at Cloud Native Buildpacks support in Spring Boot 2.3 Milestone 1

RugDoc Expands to Avalanche to Keep DeFi Users Secure

Multitasking in iOS 9 for Developers and Designers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Louis Tsai

Louis Tsai

if someone can give me a lesson of how to adult that’d be great thank you

More from Medium

Android’s IME Actions: Don’t ignore them.

Building Contextual Mode of Top App Bar in Jetpack Compose

Compose Destinations: A simpler way for compose navigation.

Dive into Jetpack Compose: Building a Quiz