I wonder what would be the best to prepare for Compose. I know we have like a year / year and a half till 1.0, so it gives us devs plenty of time to prepare at our ease. I guess a good separation between data loading and UI would be nice. I am sure apps created more than 3 or 4 years ago aren’t there yet.
2 years ago
Any kind of unidirectional data flow architectures will be useful here; push state down the UI and let events flow up as they are generated by user action. Keep a firm separation between state vs. events.
Unsurprisingly a lot of the Android architecture components coming out of Jetpack have known this was coming and have been gently guiding things in that direction already
Things like the new back button dispatcher and activity result APIs in jetpack have had compose in mind and both wrap into a composable function that can be present or absent as part of a composition quite nicely
Lots of thought and work around fragments, navigation, etc. too
yeah about unidirectional data flow architecture, that’s the trick, the app I’m working on at work has a kind of custom Loader APIs before the loaders API existed. It does the job, but our screens are heavy and do everything
So my goal till Compose releases is to get to have a good unidirectional data flow first, then it’ll be easy to migrate
I work on a fairly large codebase (couple million lines of code), and over the last 3 or so years we've been gradually migrating everything to explicit state machines, written mostly declaratively (we built a little library to help with this). At this point we've migrated a little over half our codebase. It's slow going, but worth it. As a result, our UI is now actually begging to be written in something like Compose - classic Android views are awkward to use when you just want to declaratively update everything from a single source of truth. And as a bonus, our developers are also now thinking in a more "declarative" way, which means a lot of the biggest mental adjustments required to move to Compose are hopefully already done, just with different names.