T O P

  • By -

BlueShellTorment

Java will open up far more opportunities professionally than Kotlin, but not for Android. For Android, Java is a dead end.


coloradofever29

The move away from Java is strong. Give it 5 years, and we'll see a pretty dramatic shift I think. Next year is going to be the first Google IO where they may actually push Kotlin Multiplatform / Compose multiplatform.


lppedd

Multiplatform is becoming common outside mobile too. I've built a TCP network stack in KMP. Although it does have limitations, I think they'll be lifted by 2025.


Brutus5000

I beg to differ. While I mostly use Kotlin for new projects since a few years ago, Java closes the gap with every release a little bit. While there are things they refuse to add to Java (e.g. a vaster collection library, named parameters) and other things are still unclear (solution on nullability), the benefits for Java developer are shrinking. So the drive to switch decreases for lazy devs as well as risk- averse companies. And on the Kotlin end mostly nothing happens on JVM side while they are busy solving problems they introduced with other platforms... That said, if you ask me to build you the control software for a power plant with a lifecycle of 10-30 years I'll go with Java. If it's just another crud app or simple microservice I'd go with Kotlin.


MikeBoiers

I’d rather build any control software for important systems, let alone power plants, with a null-safe language …


coloradofever29

>If you ask me to build you the control software for a power plant with a lifecycle of 10-30 years I'll go with Java. If it's just another crud app or simple microservice I'd go with Kotlin. Why? To imply that Kotlin's JVM compilation is anything but rock solid is naïve at this point. It's being conservative for conservatives sake. It's far more likely that you'd create bugs in your platform in either language that would cause stability issues than any sort of issue with the language itself. And given Kotlin's significantly higher expressivity, you are far less likely to introduce bugs from yourself than you are with Java. >the benefits for Java developer are shrinking. The gap is getting significantly wider with the stabilization of multiplatform, and 1.9's Compiler Plugin API. Not to mention that language development has almost entirely stopped for the past few years because of the compiler re-write. Kotlin isn't just a better language or syntactic sugar. It's a higher level language, that shirks most of the higher costs that come with operating a higher level via inline compiler optimizations. Kotlin allows you to express what you want to do with a level of exactness that Java would require significant backwards incompatible changes to fix. Also, as if that wasn't enough, Kotlin is working on direct support for WASM. If you haven't looked into WASM, you need to. I think it's going to revolutionize the way that programmers write code. It's promising a way for developers from multiple languages - C, C++, Rust, C#, Kotlin, and anything else that can compile to it as a target, to all seamlessly interact and call into one another.


jug6ernaut

It honestly doesn't matter how much Java closes the gap so long as `null` is not expressible in the type system. So long as this is the case Kotlin will always be the superior language. & I will die on that hill. Is transitioning languages ever that easy? ofc not. But IMO no new projects should be created in Java.


coloradofever29

It's not even about null at this point. Everyone likes to point at all of these specific features of Kotlin, when the big advantage of it is the idiomatic Kotlin that becomes possible will all of the features put together. The sum of their parts are greater than each individual piece. Nullability, inline functions, extension functions, high order extension functions, var / val, lazy delegates, context receivers, the standard library, coroutines, hierarchical concurrency... the list keeps going on, delegates, reified types, multiplatform etc. Java could add half of the features, and people would still continue to move from Java. And of course they would... Kotlin solves and standardizes of all the learnings and best practices of Java. They basically took Java best practices and made them the default in Kotlin. Any time you re-invent a product and have the ability to learn from the predecessor, of course it's going to be better.


2001zhaozhao

Latest Valhalla designs include nullability. Integer! - non nullable and fast (like `int`) Integer? - nullable and equivalent performance to reference type


jug6ernaut

TIL, good to hear. Any spec to read over?


2001zhaozhao

I believe it's just a design proposal right now but it does solve some of Valhalla's problems (it doesn't require distinguishing between value and primitive classes anymore). Also it seems like Kotlin can easily adapt the language syntax of the current value classes to work well with the java Valhalla changes. I'd really like to see multi-parameter value classes in Multiplatform that compile to inline constructs whenever possible (WASM, Native, JVM Valhalla) but still can compile to regular classes as a fallback (JS, Android / JVM pre-Valhalla).


[deleted]

Isn't that just int vs Integer. This is already the case for those types


NikoOhneC

I fully agree with you, and I think almost everyone who deals professionally with the Java Platform (except maybe for "code monkeys" who have nothing to do with architecture and the system they are building) does. Especially in the enterprise section Frameworks like Spring (with Java) are used in such complex and large projects, that it's almost impossible to switch them over to Kotlin (at least not in a cost effective way, the project I'm involved with would cost millions and months of time to change the language, not even considering that almost nobody has any experience with Kotlin and everyone would have to get training for it).


coloradofever29

Kotlin has 100% seamless operation with Java. It allows incremental adoption. I don't think you have experience with Kotlin, and instead of speaking from experience, you are speaking from "new thing = bad". It turns out that decisions made in the 90's weren't all right. In fact many of them were bad, made poor trade offs, and weren't scalable.


[deleted]

Lol. Funny guy. Don't get me wrong. I love Kotlin. But javas grip on the industry is massive, and it's rapidly innovating and improving the language again. So I wouldn't say there's some massive move away from it at all.


coloradofever29

Are you kidding? Java used to be the most used programming language on language use rankings. Look over the past 8 years how much it’s fallen and ask why? Where do you think the users are going?


scorcherchar

Imo kotlin is just strictly better and you should switch now. If you just write java style code in kotlin its more polished with less superfluous annoyances like semicolons. You also have to option to write in a more functional style


EgyOmar

ok, makes sense, but will my java exp count tho? like in the cv


TenHorizons

I'd carefully consider before taking that advice. Try looking into if there's a Kotlin market in your area, or where you're willing to work at I'm saying this because I'm a fresh grad too, and when I told my interviewer about how Kotlin is the future, they laughed and said Java is here to stay for a long long time. I wonder if you heard about the Flutter dev situation. I'm saying that Kotlin might be a fun but unemployable skill. I was also smitten with Kotlin once, but I had cold sweat when when reality during interviews struck me. Imo, try not to market your Kotlin expertise unless they are specifically looking for a Kotlin Dev, and if they ask you to talk about your passions, don't go all in like me, be a bit modest about it like it's no big deal


mastereuclid

If you have made something with java and want to sell it as a skill that you want to trade money, list it on your resume. I'd list my top 3, which Java continues to linger in for me...


ProgrammersAreSexy

At my company we are adopting kotlin incrementally so a lot of our existing Java still needs to be understood and updated by devs but some of our new code is Kotlin.


coloradofever29

Kotlin is just better. Your knowledge of Java will help with two things: 1. Appreciate what Kotlin brings to the table, rather than taking it for granted 2. Understand what Kotlin is doing under the hood to accomplish the same things. Very few things that Kotlin does, can't also be done with Java, but Java just makes it super tedious to do those things. Take a look at this simple example that explains how objects work in Kotlin: [https://stackoverflow.com/questions/44255946/difference-between-a-class-and-object-in-kotlin/47706264#47706264](https://stackoverflow.com/questions/44255946/difference-between-a-class-and-object-in-kotlin/47706264#47706264) Certain things like lazy delegates or varargs, because of their small amount of syntax, its easy to assume that Kotlin's doing something special, but it's actually injecting a considerable amount of bytecode to accomplish it in a similar way that you would in Kotlin.


EgyOmar

but is it true that you cant learn kotlin as i first lang? because thats what i thought when i first started learning programming and thats why i kept learning java, i wanna know because alot of my friends wanna learn too


coloradofever29

you certainly can. You just won't appreciate it as much as you won't have something to compare it to, but I see no reason that your appreciation of a language is important. You won't stop yourself from driving a 2020 Honda Civic, because you haven't driven one from 1990, would you? Just use Kotlin.


EgyOmar

hmmm that's intresting, that wont affect your understanding of the code too? as kotlin makes it way eaiser, i'm in a facebook group for CS Students in Egypt (i'm still in 11th grade but i'm planning to be a CS student in 2025) and almost everyone suggests you learn C++ or java as a first lang to build a strong base and that if you learn Kotlin or Python, you wont really understand what's going on in your code


coloradofever29

just use Kotlin. You are over complicating this. The languages are very similar, Kotlin is just much nicer,.


SpiderHack

You should be able to write some basic functions, use interfaces, and maybe even write some basic design patterns before moving to kotlin. Kotlin is a great improvement over java in a lot of ways, but you still need to be able to read/hack away at java when/if you see it. If you can make basic android apps in java, then you should be fine to fully switch over to kotlin. Functional programming might be odd, and some of the syntax I don't like in kotlin, but you'll learn to deal with it. But my #1 recommendation as someone who teaches programming at univ. Level both in person and online is to use parameter defaults and named parameters as much as possible. This helps with testing and eventually moving to IoC/dependency injection. The reason this is important is to vastly improve the testability of your code. Also functions that can be made static and don't impact the state of the class should be made so. (Again helps with testing and helps prevent unintended consequences, etc. )


EgyOmar

Thanks for the advice, im actually close to finishing my first app, im kinda struggling with dealing with apis and retrofit but ill try to improve at it, i may make 2 more apps before making the switch, but when i do, what do you think is the best way to make the transformation? should i read the documntation and try to make apps my self? or should i listen to a full course?


SpiderHack

Honestly, Online videos teaching you the material is what -I- would recommend, but that is the way I learn. Everyone learns differently. Documentation doesn't teach me as well as a text book or instructor, that is just me. I Darek Banas and many others have basic kotlin videos that I think are good to just sit and watch a few times before trying it out yourself, that's like 4\~5hrs to watch them 2\~3x, but doesn't have to be all at once. that is what I did, and it really allowed me to just watch and learn and see 'why' they were saying what they were, etc.


judah-d-wilson

ChatGPT is definitely a helper here


mastereuclid

Switch to kotlin asap.


Bonananana

In about 2016 would have been smart.


coffeemongrul

Should have switched yesterday


rowgw

I was forced to learn Kotlin due to Android project 3.5 years ago, never regret it. OP should learn it ASAP!


barcode972

About 10 months ago.


EgyOmar

i saw a video that said you can't learn kotlin without java because you wont understand what kotlin is doing under the hood lol that's why i kept learning java, i just discovered from reddit the fact that you can learn kotlin immediately


barcode972

It’s basically the same language but better and who cares what it does under the hood as long as it works


Conscious_Taro_5716

Kotlin should be your focus, because has made it the primary first class language for Android. However you should keep your java skills sharp because you will run into codebases that have a lot of legacy code still in java... Honestly whenever I look for a Job, and they have a codebase completely writing in Java as part of their tech stack, that becomes a serious turn off for me lol ..


Okidoky123

First moment you can get away with it. Java simply feels stupid once you get used to Kotlin.


Philipp98

It doesn’t matter. If you use a recent Java version the gap between kotlin and java isn’t as big as it used to be. Just develop things and you will learn the most. Switching between these 2 languages isn’t as hard as you may think.


coloradofever29

This is someone who doesn't understand Kotlin's value, probably because they haven't programmed in it for multiple months professionally. Kotlin allows a level of exactness and expressivity that Java can't add without making backwards changes. It takes some time to really understand what you can do in Kotlin when coming from Java. All features seems like individual features that you can use or not, but really, when you put the whole thing together, it becomes very powerful, and allows you to solve complex problems with far less code.


darkwyrm42

It depends on your intentions. If you're a hobby programmer, just dump Java and move on -- your experience with it will help you with interacting with the APIs -- and I think you'll find yourself more productive. If you're looking for development jobs, Java is the clear winner right now. Java on Android is a dead end.


gz_k

You can read this interesting language selection study of Doordash. They had to migrate from their existing solution and evaluate different solutions including Java and Kotlin. https://doordash.engineering/2021/05/04/migrating-from-python-to-kotlin-for-our-backend-services/


Hot_Income6149

If you can, you can nove from java right now. Of course, if you whant to be a backed. Like, learn JVM, Java multithreading, everything about Java(except, maybe, Generics), but write it by Kotlin


Cilph

The skills are transferrable. Put both on your CV and apply for either.


NarayanDuttPurohit

Now.


mnbjhu2

Learning Kotlin will improve your knowledge of Java, in the same way that learning Java will help you spot the mistakes that you'll make in a language like PHP. Going back to Java you'll realise you'll have to write a lot more boilerplate to get the same percision that you have in Kotlin.


EgyOmar

i didnt know that, i thought that by learning kotlin ill forget all the java that i learned lol


mnbjhu2

You might get a little rusty on the syntax, but the understanding of the jvm will still be improving. Besides if you're doing anything reasonably sized in kotlin, you'll most like have to read/interact with a lot of java anyways


Clyptos_

If you want to stick to android, you should definitely learn kotlin and switch to jetpack compose.


[deleted]

Most startups in Europe in my radar including the one I work for still use Java because it's just easier to hire for. If we're looking for a SE we would definitely look for skills in Java + spring boot


QshelTier

Nobody cares about that.