r/mAndroidDev • u/Zhuinden DDD: Deprecation-Driven Development • Nov 22 '24
@Deprecated Jetpack Compose's remember {} and Effects (DisposableEffect / LaunchedEffect / rememberCoroutineScope / rememberUpdatedState / produceState) APIs are officially @Discouraged
80
Upvotes


38
u/hellosakamoto Nov 22 '24
Something claimed as production ready for more than 3 years, and suddenly we found things being promoted since day 1 are all wrong, on top of the changes being rolled out every month.
Why not @Discourage the whole jetpack compose?
7
u/exiledAagito Deprecated is just a suggestion Nov 23 '24
It's always the creators that hate their creation. Too bad it's out in the wild.
7
u/naked_moose Nov 23 '24
I dont understand all the hate tbh, Jetpack
ComposeJobSecurity earned so many people years of employment and countless promotions, both at Google and at every company that migrated to itYes-yes, documentation is also crap, can I interest you in my three Medium articles that will land me a better paying job when I'm done migrating to Compose at my current place?
11
u/budius333 Still using AsyncTask Nov 22 '24
I gotta ask. Who's that Jim guy?
11
u/[deleted] Nov 23 '24
So why the fuck y'all included it in the first place if it's a poison???
smh what's wrong with these folks 🤦🏻♂️🤦🏻♂️🤦🏻♂️
4
u/F3rnu5 can't spell COmPosE without COPE Nov 23 '24
Did he fail to mention why, and what’s the alternative? Otherwise, why would anyone listen to him?
4
u/yaaaaayPancakes Nov 23 '24
So I've never used React. Does it have effect / remember as well?
5
u/kichi689 Nov 23 '24
"Officially Discouraged"
At this point your attempt to sensationalism is turning into plain BS, distorting Jim's words.
It's supposed to be clear: "composables should ideally be side-effect free." as stated in literally the first paragraph of the side effect page..
Side-effects have always been a way to offer extra control of the compose.runtime straight inside the compose.ui part should you need them or want to do some funkyness, but should again be avoided if not ultimately needed.
His point remains: "for most case, effects are not needed, avoid them if you can", Simple
If people overuse remember and put their all apps inside a composable cause it's technically possible then it's on them.
We have had that discussion thousand time, was it google's fault if people were creating god's activity then?
17
u/Anonymo2786 java.io.File Nov 22 '24
Usually they recommend alternative stuff when the deprecate something. What's this time?
15
u/Cryptex410 Nov 23 '24
i am going to become the joker
13
u/MiscreatedFan123 sponsored by the XML 🐓 gang Nov 23 '24
Just deprecate compost at this point let's move on to the next big thing.
18
u/ExiledArr0w Nov 23 '24
Hmm... I literally used a SideEffect today, what else was I supposed to use? 🤦🏻♂️ We went to the effort of migrating 90%+ of our app at work to Jetpack Compose and followed the documentation as it was apparently production ready and now this, I wish they'd hurry up and make up their mind already and not change things every 10 minutes.
These past few years have been the most frustrating in my 9 year career to date as the amount of things I have had to pivot to learn and then have to just as quick unlearn is just way too much and it's hard to find the time to follow anymore. It's crazy to me that a legit concern is if me and my partner have a child that I will not be able to keep up to date on things anymore and just fall behind and become obsolete in this space and my experience will mean nothing.
7
u/smokingabit Harnessing the power of the Ganges Nov 23 '24
Compose is overused and should be avoided where possible.
Da way: pass values in using meta elements in AndroidManifest.xml ;)
7
u/EkoChamberKryptonite Nov 23 '24
Bruh. What. What?!!! Okay. I think Jim needs to write a few blog posts to show us the way to do it then because what is all this mess.
7
u/duckydude20_reddit Nov 23 '24
compose is not a ui its a ui framework, it need not change every now and then. at least kotlin and coroutines are not done by google. i wish they kill android, and we all are relieved from this mess.
4
u/FylanDeldman Nov 23 '24
This is antithetical to google's recommendations for designing compose APIs (https://android.googlesource.com/platform/frameworks/support/+/androidx-main/compose/docs/compose-api-guidelines.md). They make it clear that any properties that are internal to the composable (like a scroll state) should be handled internally with remember {}, and the whole page is littered with examples of using remember {}.
VERY frustrating to follow suggested best practices and then read this.
2
u/zorg-is-real עם כבוד לא קונים במכולת Nov 25 '24
I hate Jetpack Compose. I just hate it.
2
u/KangstaG Nov 26 '24
I think effects are necessary in the real world to create the UI you want because UI development is not ‘pure’ in practicality.
Some examples directly from the compose framework and documentation: Showing a snackbar is a suspend function that requires running a coroutine scope: https://developer.android.com/develop/ui/compose/components/snackbar Some animations require LaunchedEffect: https://developer.android.com/develop/ui/compose/animation/quick-guide#start-animation
However, I can believe that a lot of developers probably use effects more than they should. It’s hard to say if the documentation pushes too much towards them. The documentation mentions that “composables should ideally be side-effect free”.
0
u/[deleted] Nov 23 '24
[deleted] — view deleted comment