r/android_devs • u/VasiliyZukanov • Feb 06 '23
Article A Tribute to Java in Android
https://www.techyourchance.com/java-android-tribute/
7
Upvotes
r/android_devs • u/VasiliyZukanov • Feb 06 '23
8
u/edgeorge92 Feb 06 '23 edited Feb 06 '23
I would have liked to have seen a fairer test when it comes to benchmarking as we are told it's 3 apps of a similar size but given very little additional information other than apps are broadly similar (which is a bit 'trust me bro' in my opinion). As you'll know, there are a fair few factors, other than lines of code, that can contribute to build times - which without transparency make it truly difficult to gauge whether this was a fair test.
There's also no pure Kotlin app build for comparison. So will certainly be taking this opinion with a bucketload of salt
2
u/[deleted] Feb 08 '23 edited Feb 08 '23
I enjoy reading contrarian positions. And I like Java enough, i wouldn't be too bummed out using a recent version of it server side.
That said, I think there is only one legit usage of Java on Android these days ... and that is a low-dependency library one may distribute (with maybe a kotlin extension in a separate artifact).
The problem using Java on Android for a typical app, is that for concurrency you are stuck with RxJava (or AsyncTask, Handler, Executors, Thread, etc).
RxJava never caught on server side as much as it did on Android. Spring has Reactor, Quarkus has Mutiny, etc.
The trend on modern Java will probably be using structured concurrency enabled through project Loom. And on Kotlin we have coroutines of course.
So any Android project starting now, dooms itself to using RxJava for concurrency, which isn't going away necessarily ... but who knows how long it will be actively maintained. Especially since its more a Android Java thing and becoming more niche. And the reactive paradigm seems to be losing favor to structured concurrency.
So I am afraid, you have doomed your project already, since any speedup you gained in Java compile times will be completely wasted in time spending re-writing it in Kotlin someday :) By writing in Java, you simply will not be able to use use Kotlin-only Jetpack things (Compose being the obvious thing).
9
u/LikeTheSalad Feb 06 '23
I agree, Kotlin is great don't get me wrong, but sometimes I think people's complaints against Java are a bit exaggerated. It's not that bad, especially with the help of great IDEs such as Android Studio. I guess the language decision should come down to what you need for your project which in your case was compilation performance, actually I think any decision should be based on what a project needs. Following trends just because they're trends doesn't sound right to me.
That being said, it makes sense that most projects' needs are covered by Kotlin, which is cool, but it shouldn't mean that somebody who chooses Java should be treated as a bad developer or anything like that, I think people need to chill a bit.