Java vs Kotlin... the future

Why do “kotliners” think Kotlin is better than java?

As far as I know the same Kotlin structures can be done with Java +8 - 10 (with lamda expressions). I would understand if we pitted old versions of Java against Kotlin. But really everything that Kotlin does (reduced) is also done by Java in versions +8, 9 and 10. (To do everything primitive)

There is also version 11,12 … 16, which gives us “three times more” help I don’t think you want to do really complex stuff in Java to use version +10, like cloud or others.

Everything “small that can be done in Kotlin” can also be done with Java and its future versions.

I think it’s a matter of taste if you like to call it “private fun nameMethod (): String {}” instead of “public String nameMethod () {}”, feel free.

I have been looking at Benchmarks and Java is much faster. By the way, when I compile Java in “Eclipse” (does that still exist?), It is much faster in project builds than not Intellij with kotlin

I suppose “objectively” that if we joined PHP + Java we would have Kotlin.

Without a doubt there are always a few who raise their voices a lot … the bad thing about that is that even if they are few they make noise. Kotlin will be the future!
How many times since 2004 have I heard the argument WoW killer? 17 years.

I could name many features that are available in Kotlin and they are missing even in the newest Java, but… what is your point really? Blink twice if some crazy kotliner kidnapped you and force you to use Kotlin :wink:

9 Likes

Good new, I am awaiting that day to come back to Java.
In the meanwhile I release my server in production.

8 Likes

I’m an embedded Android developer. I currently have access to most of Java 6, a handful of Java 7, and some Java 8 language features that the Android build tools translate into earlier Java bytecode. I can, however, use all the latest Kotlin features.

Yeah, future Java has some cool features coming (Loom, Valhalla, records). But I like Kotlin now (coroutines, extension properties) and it has features coming in the future too (I’m excited about context receivers).

Actually, Kotlin has kinda “killed” Java in the Android community. From wikipedia:

As of 2020, Kotlin is still most widely used on Android, with Google estimating that 70% of the top 1000 apps on the Play Store are written in Kotlin

In general though, it’s not a Java killer. It’s not a Javascript killer. It’s not gonna kill C++ either. It is its own language with its own priorities (like selling IDEs) and philosophies and it can succeed just fine with all these other languages around too.

6 Likes

While there are many features Kotlin offers / enforces that I would miss from Java the big win is multi-platform.

I develop full stack applications (web, mobile, server) and I can use Kotlin everywhere. All my programmers can use Kotlin everywhere. While some may lack details about CSS they do not have to know JavaScript. Have you ever cut and pasted code from a web page into an Android app? I did. And it felt so good to skip the re-implementation.

I’m a data model freak. I think that data models define the application (if you think about it, an API is also just a data model).

What Kotlin MPP made possible is to write one common code that contains the data model (with proper constraints for validation) and use it everywhere. This has en effect on many-many things. For example: I do not write validation for web forms, on server side, on mobile. What for? I have one common schema definition and everything works from that.

I don’t even tell my form builder what kind of field is that: the schema contains the information. I don’t write/generate communication API-s. They are “simply there”. Type safe, full schema information.

Doing this in Java is “somewhat possible” if you bend backwards (think of Vaadin). With Kotlin MPP this is natural.

6 Likes

No offense, but you were the same person stating that null-safety is a redundant feature in Kotlin and 7 hours later you’re making this post arguing that there’s no reason to use Kotlin over Java.

If you’re genuine in your questions, consider asking them in a less accusatory tone. People are much more likely to give you their opinion if you don’t turn everything into a debate.

13 Likes

I do not understand what this argument comes from. I recommend that you read carefully before “darkening” anything

Those of you who start with “Don’t be offended”, you already tell me everything.
“If you are willing to throw the first stone, do not be scared if they reply to you.”

“7 hours later you’re making this post arguing that there’s no reason to use Kotlin over Java.”
At what point in the argument have you read this? I recommend that you read carefully, because this argument does not make sense. I do not know what you have been able to understand to make such a argument.

“consider asking them in a less accusatory tone”.
My tone? Well, it seems that you don’t understand what written and oral language mean. I recommend you read at least about them.

Now, your argument about “a tone in a written form” (“consider asking them in a less accusatory tone”), that argument, if it is disrespectful and does not denote much.
I will not continue arguing with people of such caliber.

If you are really interested and not just attracting attention to yourself, all answers are here: Is Java catching up with Kotlin?. You could have simply searched…

6 Likes

Who cares that java catches up with its newer releases if it is still just Java whereas Kotlin is simultaneously java, javascript and native?

2 Likes

We use it for in-house software, both server (custom network protocols, no web or fancy frameworks) and desktop (traditional Swing GUI, no mobile or web stuff here).

The primary reason to use Kotlin is null safety. The same one you asked to explain in the other thread. I’m currently working on a project that has a lot of complicated data structures with lots of optional parts. Being able to know what and where can be missing is extremely helpful.

Everything else is more or less syntactic sugar that is helpful too, but nothing too critical, really.

3 Likes

Taking a code without a “frameworks” makes me … go back to those times where the code was a “| @ # Ø”. Feel free. I hope that in Spain they continue to use the official standards with the use of frameworks. Many good practice standards have worked hard to instill good practice so that then some come to break that …

https://discuss.kotlinlang.org/t/error-nullpointerexception-null-safety-vs-manually-verify-that-the-object-is-null-redundant-concept/22419/10

Java and Kotlin could coexist. Like C / C ++. Why not…

Amazon, FaceBook, Ebay, NETFLIX (now Kotlin), Twitter and countless of them have Java.

I may need a little sugar with my cup of coffee.

Making analogies to large projects
We will always have to see if there is a Java Killer / WoW killer.
Right, pretty Black Desert?

I’d be real happy if there were frameworks for processing that crazy telemetry of Russian spacecrafts and the Russian ISS part, but sadly, there are none…

Not only they could coexist, but they already happily do so. That’s another big advantage of Kotlin, that we can just take a pile of legacy Java code and start adding a pieces in Kotlin here and there.

5 Likes

I feel your pain. And Russian software is definitely not the worst. Most of CERN software is not only poorly documented, but also written in C++ with zero interop. By the way, there is a #science channel in the kotlin slack dedicated to this kind of things. And we also have a lab chat in telegram (in Russian).

2 Likes

If I met a person who heard about Kotlin and is interested in my personal opinion on why I prefer it over Java then I could basically point him/her at the Kotlin feature list. There are very little features of Kotlin that I don’t use. I could probably list 20-30 smaller or bigger things that I really enjoy in Kotlin and miss in Java. And contrary to what you say, 90% of these features are not available even in the latest Java. So I could answer your question if you want. But honestly, I doubt you are interested in my answer.

You don’t seem to come here to find out why do people like Kotlin. It looks like you came here to state that you dislike it. People could list many reasons or features, but you will just say you don’t need them or not like them. Why should anyone care? The question was why people use Kotlin and not why you should use it.

This reminds me good old discussions like: Windows vs Linux, PC vs console, etc. I don’t think people here actually care to argue that their language is the best in the world. I don’t know if you noticed, but the only person here who called Kotlin a “Java killer” is… well, you.

14 Likes

Something we agree on. If one language helps the other, they can live together.

But the slogan that I have read from the Kotliners in many forums, that Java is going to become obsolete, this is not going to happen. Who says that tomorrow they will not modify it to put new implementations? Like a Java 2. Same for Kotlin. It is possible that in the future both languages will be written in 10 lines instead of 300 lines.

I am listening to your ideas about Java and Kotlin as many Kotliners and Java users.
Now if you mix the previous post about the misconception (which has nothing to do with this one) and mix what I say in that post with this post, you can change the context and you can make those claims. Let’s better focus on this post.

The root is that I am hearing the “Kotliners” say that Java is deprecated. Maybe the few “Kotliners” make noise (so much that they have reached my ears) that I suppose you will not be the majority, because as in all groups, there are always a few who blacken the group, while there are others who expose their advantages .

In this post, I am hearing what you like about Kotlin.
It would be productive and positive for everyone if it did not turn into a battle discussion.

Ok, if this is the case then I at least understand your point. While I consider myself a huge fan of Kotlin, I would not call Java deprecated. Java is fine, it has a very strong ecosystem and it doesn’t go anywhere. Whenever there is a new technology, some zealots will appear.

One scenario where it makes sense to call Java code “legacy” or “obsolete” is if some company decided to switch from Java to Kotlin and rewrite the existing code or add a new code in Kotlin only. But even then Java itself would not be “obsolete”, but only parts of the application that are written in Java.

3 Likes

The funny thing it’s the first time I hear about it, even though I read these forums from time to time. Perhaps you’re reading the wrong Kotliners.

I find myself rarely writing new code in Java, though. Not because I think it’s obsolete or deprecated, but just because it’s often easier to do the same thing in Kotlin. I often ask myself, do I have to write this in Kotlin? Won’t it be just as easy to simply use Java? And most of the time the answer is no, it won’t. Null safety, or a couple of convenient data classes, or something like that almost always comes up that makes using Java pretty much pointless.

I do use a lot of Java libraries though. I sometimes hear things about “cool” “pure Kotlin” libraries, but completely fail to understand what’s so cool about them (unless one wants to go multiplatform, of course). Things like Guava and AssertJ work wonders with Kotlin just like with Java.

4 Likes

Many years ago I looked at Java and hated the fact it was an anal language.
So many things string and unwelcoming and so much boilerplates you could not make the code from the fluff.
When I looked at kotlin i immediately fell in love, slick and to the point.
The fact that Java runs today to add all the features kotlin provides does not really change those facts.

4 Likes

This is the dream: Java 16 with all the new features and then 17 and 18 will be even better and I’ll be immediately be able to use them.

This is the reality in enterprise and android land: Java 8 or even just Java 6, forever. And if an upgrade ever happens it will only be to the next LTS version.

We will always have to see if there is a Java Killer

I don’t want to kill Java. I don’t think Java will die and if it did it would not be good for Kotlin. After all a lot of Kotlin runs on the JVM and uses the Java Standard Library.

The fact of the matter is that when I program in Kotlin I never think about Java. When I have to program in Java I always miss Kotlin. Knowing Kotlin as well as I do now, it would never occur to me to write anything in Java unless forced to by my employer.

4 Likes