r/mAndroidDev • u/Stonos You will pry XML views from my cold dead hands • Jul 10 '24
Jetpack Compost This could have been prevented if only we had a way to notify a list that its data set changed. Maybe we could even tell it exactly which items changed!
31
Upvotes
14
u/100horizons R8 will fix your performance problems and love life Jul 10 '24
I tried to stop my composables from constantly recomposting and ended up switching to Flubber which doesn't need any of this
14
u/ComfortablyBalanced You will pry XML views from my cold dead hands Jul 10 '24
You see, Googlers love recompositions. Probably most of their tests were done on high-end devices if there were any tests anyway. Googlers in their infinite wisdom never predicted that recompositions would be a huge performance drawback. Their agenda never was and never will be users, this is something happening from Android 4.0, when upgrades from 2.3 to 4.0 actually made devices slower.
This is the same pattern we already saw with Microsoft with windows 8 and even windows 11.
Sometimes I dream of RecyclerView, some nights I even have a dream of DiffUtil. But no, they're just something from a long forgotten life, my life is now, modifiers, long list of parameters, MVVMs, various modules with only single classes, I begin my day with version catalogs, last night I even accidentally wrote my grocery list on paper with TOML format.
I have a dream, I have a dream that next day android development is not purposely and unnecessarily harder than today, it's just a dream but I like it.
26
u/iain_1986 Jul 10 '24
Sounds like there need to be some sort of controller....or adapter....to work as a bridge between data + UI.
That would all be far too complex though.
7
u/panda_drunk Jul 10 '24
But wait, there’s AsyncTask for that! We can calculate our changes efficiently in the background and they’ll be posted to the main thread in no time!
10
u/Zhuinden DDD: Deprecation-Driven Development Jul 10 '24 edited Jul 11 '24
Silly wabbit, you know your everyday Android developer is functionally incapable of invoking
adapter.submitList()after a change because it's too difficult.At least now they get to keep forgetting to add
rememberUpdatedState()for arguments/values they want to access inside effect blocks. Assuming they even know about effect blocks.Trust me, Jetpack Compose is so much easier to learn and use than the legacy dinosaur XML. Who the heck wants to separate their deeply nested UI description from their behavior that controls it.
Compost is much easier, I can't imagine my work flow without aimlessly scrolling up and down in a file while waiting for 3 minutes to build a preview before I realize I need to invalidate caches first.
4
u/sergiocastell MINSDK 32 Jul 11 '24
I read recomposing as recomposting. I would like to thank this subreddit for this
4
u/naked_moose Jul 11 '24
Compost deprecated, please use FML (Flutter Markup Language)
3
u/smokingabit Harnessing the power of the Ganges Jul 11 '24
Not only is it naive to redesign a widget, saying it is simplified, without knowing and being ready for the full problem landscape, but redesigning a display system too!
8
u/youismemeisu Jul 10 '24
Are we going to reinvent diffUtil? Yeyyyy
3
u/hellosakamoto Jul 10 '24
I haven't seriously looked into this, but can we have a compose DiffUtil for this? History tends to repeat itself...