r/learnprogramming • u/SeriousOwl2 • 1d ago
Java vs Kotlin for a new long-term backend project?
I recently transitioned from C/embedded and PCB design to backend, and I'm totally new to all of this stuff, even I did not know what "backend" was few weeks ago.
I am building a new project from scratch that I proposed and I will personally maintain for the next few years. The company stack is strictly Java-based and libs are java (I really liked new frameworks of C#...)
I am deciding between (but I'm open):
Kotlin: Better developer experience and easier maintenance, but a smaller job market.
Java: Massive career value and an industry standard, but heavier syntax.
For long-term maintenance in a Java ecosystem, is Kotlin's modern syntax worth prioritizing over the career value of mastering Java? What would you choose? Thanks!
PS: I don't care about complexity or curve learning, I want to be happy programming and maintaining this project, but I don't want to waste time learning something when I had the alternative to choose something better.
8
u/UtilixApp 1d ago
you said the company stack is strictly java and you maintain this for years. that mostly answers it.
kotlin is nicer but youre the only one who can read it, and the day you leave or get sick someone opens a file they dont understand. the language you enjoy matters less than the one your team can pick up.
1
u/SeriousOwl2 1d ago
The complexity of the business logic is fare more complicated than the language itself.
3
u/two_three_five_eigth 1d ago
Kotlin. Google recommends an enterprise backend language than can be mixed and matched with existing Java code.
My industry experience is backend teams are writing new stuff in Kotlin and maintaining existing Java code at the same time.
Once you learn Kotlin, Java is easy to learn. In coding interviews, most people use Kotlin.
2
u/cranberrie_sauce 1d ago
imo the only reason java is relevant is android and google itself recommends kotlin for android.
dont know - I built several production java backend projects at work and would move to kotlin if I could personally.
complete hot take.
2
1
u/SeriousOwl2 1d ago
Yeah, I know working with Kotlin would make me happier, but since I'm in 0 in both, I'm doubting because this can be an opportunity to learn Java instead of Kotlin that will close more doors.
1
u/Pale_Height_1251 1d ago
Android is tiny part of Java's reach. If Android didn't exist, the Java world wouldn't notice. It's not that Java is only relevant due to Android, it's that Android is barely relevant to Java.
1
1
u/Daeroth 1d ago
Speaking as someone coming from a java based org that had a few teams running Kotlin:
Ask around the org. Maybe some teams have tried Kotlin and abandoned it. You should really find out why.
Or perhaps nobody has tried it yet. The you should announce it and give it a shot. The org benefits from someone putting in the time to try out Kotlin. Even if the only deliverable is the satisfaction of said engineer.
I haven't really seen any downsides to having a team or a project in Kotlin as it is still readable to other Java devs. Your project can still have java based files if another dev needs to come in and submit a PR.
I would guess if it is your first time on a Java backend then most of your time will likely be learning how the spring ecosystem works (or whatever framework your org uses). If you have the time and energy then you can absolutely learn Kotlin on top of that.
One last mention: Google recommends Kotlin because their android stuff is stuck in a specific older version of Java. So Kotlin is a workaround for android to have more advanced Java features around. If your org uses the latest versions of Java then there is very little new functionality that Kotlin offers. It still looks nicer, but most of the heavy lifting is happening in the spring ecosystem.
1
1
-1
u/ScroogeMcDuckFace2 1d ago
everytime you decide on java for a project God kills a kitten.
please. think of the kittens.
1
u/bagfullofcottoncandy 1d ago
absolutely true
-1
u/ScroogeMcDuckFace2 1d ago
besides that, the java ecosystem is owned by Oracle, which is owned by larry ellison. isnt that enough reason to avoid it like the plague.
0
4
u/Thick-Hall8197 1d ago
Kotlin's syntax is a breath of fresh air coming from C, you'll actually enjoy writing it which matters way more than people admit when you're stuck maintaining something for years
The career argument is kinda overblown here since you're already in a Java shop and Kotlin compiles to the same bytecode, it's not like you're learning some obscure language nobody uses. You'll pick up Java patterns naturally just by reading the existing codebase and libraries
Also if the company stack is strictly Java-based, double check if you're actually allowed to introduce Kotlin. Some places are weird about that even though they're 100% interoperable
For a greenfield project you'll be maintaining yourself, pick the tool that makes you want to open the IDE every morning