r/android_devs • u/VasiliyZukanov • Dec 24 '20
Article The State of Native Android Development, December 2020
https://www.techyourchance.com/the-state-of-native-android-development-december-2020/3
u/racrisnapra666 Dec 26 '20 edited Dec 26 '20
Hey there, loved the article.
There's just one doubt that I have. I quite didn't understand how View Binding would replace Data Binding.
I'm still quite new to the world of Android Jetpack libraries and I saw that usually people mostly use View Binding to replace findViewById. In fact, the documentation also advises developers to use View Binding if their only purpose with Data Binding is to eliminate findViewById.
In comparison, Data Binding provides that feature as well as allows us to attach our views directly to our data classes and such. Or is this feature (attaching our views to our data classes) fundamentally wrong?
Thanks.
Edit: I just got to the part where you trashed View Binding as well, lol. But my question still stands the same.
2
u/VasiliyZukanov Dec 26 '20
ViewBinding doesn't provide all the features of DataBinding (if it would, it would be the same lib). However, since most devs who adopted DataBinding, did it just to get rid of findViewById (or just due to hype), the fact that ViewBinding is the "new and shiny" way to achieve this means DataBinding will become much less popular.
Developers who used DataBinding for its other features and actually enjoy it that way might keep using it, but since DataBinding isn't "cool" anymore, I suspect that most of them will ditch it in the foreseable future.
I fully expect DataBinding to be deprecated at some point.
1
u/racrisnapra666 Dec 26 '20
I see. So, basically, it all boils down to what developers are hyped about at the moment.
2
u/Zhuinden EpicPandaForce @ SO Dec 24 '20
I really did enjoy this article. Great job writing it!
People don't like to hear that this sort of churn just isn't the norm. Especially not with how all the new tooling has more cognitive complexity than the old. I think this is especially true of Compose - even if it is the future, KMP is still fairly new and technically still alpha. But instead of talking to actual objects, you're talking to generated code you don't see that was generated by a Kotlin compiler plugin. The tooling complexity is through the roof.
I actually don't use Hilt. Kapt is just such a massive hog that in a few projects, we opted to throw out Dagger altogether, but we don't trust Kodein or Koin. Technically, those who like to avoid kapt, do end up opting for pure dependency injection, we just weren't loud about it.
4
u/yaaaaayPancakes Dec 24 '20
I'd argue it depends on what you're building.
Webdev has the same amount of churn, if not more. Perhaps they've settled on React as the app UI framework now, but that's a relatively new thing out of the past few years. Just a couple years ago there was Angular, and vue.js was in the mix, along w/ React. And there there's 15 different ways to do everything, since all the libraries are open source from npm these days.
If you're doing server-side development, it's the opposite. ASP.NET, Spring, Django, those leviathans bring everything and the kitchen sink into the mix, so barely anything ever changes, until the ancient creaky parts of the app frameworks become so bad someone finally throws up their hands and does something different (The big one here for me is using Retrofit/OkHttp in Spring instead of Spring's God awful RestTemplate).
Ultimately, I find Android dev somewhere between these two extremes. Yeah, there's some churn, but we're still mostly building UI with the same patterns we've always had, XML. Compose will be the first big shakeup of that. We've all settled on Retrofit/OkHttp/Okio as our networking stack, that's not changed in forever. We're mostly still using SQLite, with Room or SQLDelight thrown on top. The great war over how to do async programming does seem to be settled now as well, coroutines/flow have won the day there. I doubt that'll change since it's inbuilt into Kotlin. For better or worse, Hilt/Dagger have won the day in the DI battle.
I think in the next few years, I think Compose will be the biggest change, and that's about it. At least until Fuchsia drops and we all have to pivot there.
1
u/Zhuinden EpicPandaForce @ SO Dec 24 '20
Doesn't Spring provide Feign?
I actually don't like coroutine/flow yet, it breaks the debugger and running tasks in a superscope is oddly tricky, or maybe I was just doing something wrong. 🤔 There's Badoo/Reaktive as a competitor, I wonder where that'll lead us.
Hilt is definitely an option, but I'm not sure if that's really what's won. Some people use Anvil. We just write the constructor invocations now, with scoping provided by simple-stack.
2
u/yaaaaayPancakes Dec 24 '20
Doesn't Spring provide Feign?
Probably? Never heard of it. All I remember is the code using RestTemplate, and I yeeted that shit to the curb and used retrofit instead.
I actually don't like coroutine/flow yet, it breaks the debugger and running tasks in a superscope is oddly tricky, or maybe I was just doing something wrong. 🤔 There's Badoo/Reaktive as a competitor, I wonder where that'll lead us.
The debugger thing drives me nuts, but I can't imagine Jetbrains isn't working to make it better. I feel like with the inbuilt support of both Jetbrains and Google, and examples entering the Android documentation, all the others will slowly lose out to the inertia.
Hilt is definitely an option, but I'm not sure if that's really what's won. Some people use Anvil. We just write the constructor invocations now, with scoping provided by simple-stack.
I think it'll be just like the coroutines stuff. It's got the weight of Google's name behind it, so the alternatives will remain niche. As they said in the past, "no one got fired for buying IBM", many decision makers will follow the same philosophy with Hilt b/c its got the Google name attached.
At my current job I suggested both Anvil and simple stack. Both got rejected by the lead bc if there's something similar from Google, he'll pick that so if it blows up in his face he can say it's what Google recommends for Android to the angry bosses.
1
u/Zhuinden EpicPandaForce @ SO Dec 25 '20
At my current job I suggested both Anvil and simple stack. Both got rejected by the lead bc if there's something similar from Google, he'll pick that so if it blows up in his face he can say it's what Google recommends for Android to the angry bosses.
Maintenance gives more money than writing the code you need, if you're paid by time...
1
u/VasiliyZukanov Dec 25 '20
Technically, those who like to avoid kapt, do end up opting for pure dependency injection, we just weren't loud about it.
Wow, how this didn't occur to me?! Thanks for the heads up, I'll start asking around "who doesn't use Kapt?"
1
u/gts-13 Dec 28 '20
can you briefly explain or point me to some article what's the problem with kapt?
2
u/Zhuinden EpicPandaForce @ SO Dec 28 '20 edited Dec 28 '20
1.) it doubles your build times
2.) each time there is an error in at least 1 annotation processor, you just get
kapt internal error (no error message)as an "error message"3.) sometimes it breaks compilation, and the next time you run it, it works (predictable builds, anyone?) although I think this is an edge case. In fact, sometimes you have to delete the global Gradle build cache, and not just clean + invalidate lol
8
u/itsmotherandapig Dec 24 '20
Awesome article, I agree with most of the ideas in it.
That said, I think Kotlin's sealed classes, data classes, nullability and immutability constructs give it an advantage over Java... of course, at the significant expense of slower compilation and headaches with Java libraries (GSON is a good example).
My other minor nitpick is that ViewBinding has almost 0 learning curve, and it's extremely simple to enable. On the other hand, it's another flaky tool that sometimes breaks in funny ways
4
u/Zhuinden EpicPandaForce @ SO Dec 24 '20
Does ViewBinding actually break? Jake Wharton told me that the only edgecase I kept track of was unique to AGP 3.6.1. I haven't seen issues with it since.
3
u/itsmotherandapig Dec 24 '20
I'm not sure, to be honest. I had to invalidate caches and restart twice in the last 2 weeks, but that may also be because we started using ShapeableImageView and it was even breaking an XML layout in some arcane way.
3
u/Zhuinden EpicPandaForce @ SO Dec 24 '20
I only have this in projects with kapt in them
2
u/yaaaaayPancakes Dec 24 '20
gradlew clean assembleVariant --rerun-taskshas become my secret sauce for obscure kapt/hilt/databinding bugs.Oh the joys of trying to get a legacy codebase up to modern times!
4
u/butterblaster Dec 24 '20
What pattern do you use instead of LiveData/Flow/Rx?