Preferences


While you'll be able to start learning and using Kotlin on its own, you won't be able to escape having to pick up some information about Java along the way, especially as you dive deeper into the language or make more use of Kotlin's features.

You'll also be wanting to use Java library at some point whose documentation is in Java, so you'll also have to be able to 'mentally translate' the documentation. One of the things you'll have to get accustomed to in Java as opposed to C# is just how many libraries you'll be importing, for features where the language itself either doesn't provide anything or provides a poor implementation.

If you don't mind C#, modern Java isn't far off.

Writing Kotlin would not trigger your Java hatred at all. Configuring build systems is the same, but otherwise you won't have to do anything in Java that you hate.

As the other commenter said, the only thing you lose is (sometimes) reading docs in your language, but there is a decent Java to Kotlin tool built in to Jetbrains IDEs.

I find it strange that op doesn't seem to mind C# but hates Java when they are so similar indeed.
I'm quite surprised by this request, given that Kotlin doesn't really improve on classic Java language problems to a quantifiably better degree than later JLS improvements. Further, Kotlin seems to bring along its own design baggage from the very beginning which makes it little more than a distraction for most users I've seen try to pick it up.
Disagree. Have you ever use Kotlin? Because it's such a wonderful and simplified experience compared to Java
Java is moving in a much better direction compared to when Kotlin first came around.
as someone who has used both (on android) a bit, i also prefer kotlin, but not by such a huge margin that java makes me feel bad.

aside from nullability and a few conveniences, what are some examples that really push it over the top for you?

Java 8 has nullability plus some of the sexy functional programming stuff like map and filter.

I think Kotlin's real selling point is things like lambdas. You get stuff like Jetpack Compose, which become much more readable with it. Stuff like combine() mixed together with coroutines, which helps a lot with anything async (UI, local and remote DBs).

A practical example is combining multiple different sources into one LiveData or State variable. It's a way to asynchronously update stuff without a lot of mental overhead.

  > I think Kotlin's real selling point is things like lambdas. You get stuff like Jetpack Compose, which become much more readable with it. Stuff like combine() mixed together with coroutines, which helps a lot with anything async (UI, local and remote DBs)
that makes a lot of sense, and yes, i'd miss that if it wasn't available in java as well, thanks!
There's a significant chance that the majority of the libraries you will use will be Java libraries.

That means when you Ctrl-Click a third-party method to understand what's happening, you're going to get dropped into Java code.

This being said, Java is dead-simple -- and since JDK 17 with introduction of pattern matching, sealed types, multiline strings, records, and other things, it feels much more like C# or other modern languages than the Java you're likely thinking of.

Kotlin is probably my favorite language though, highly recommend giving it a shot.

Modern Java isn't all that different to C#. With a way bigger ecosystem and state of the art VM.
Generally speaking, I highly advise against this path. You're going to end up picking up some Java

With Guest languages (Kotlin, Scala, Clojure, Fennel, etc) you almost always end up learning the original Hosted language. Heck, most languages have an FFI that you'll end up using at some point for C interop because it's all C at the end

But you've been coding for 24 years. You're experienced enough that you can ignore most of the differences and just go full Kotlin.

Most commonly though, you'll need to know:

1. The type system. Your IDE will largely handle the Java interop but not knowing how the type system works will still bite you

2. How the class path works. A lot of issues can be avoided if you understand the build system on this level

3. Your build tool (Gradle, Maven, etc). Basically for the same reason as the class path

If you can tolerate that, you're going to be fine with Kotlin. If you can't, well, good luck and Godspeed

Note: this is setting aside Kotlin's ability to target C and JS, but those are more uncommon use cases. And obviously decoupled from Java

Back in the day, people used to ask about learning Swift without bothering about Objective-C because of the same reasons as yours. But? Swift is still controlled by 90% of libraries written in Obj-C. So all of these frustrated had to learn itty bitty Obj-C. This is the story of almost every language and its evolution.

So, you will be fine using Kotlin for problem solving even upto algorithms of Competitive Programming. But if you want to build real world use cases and projects, you will have to go through the Java Libraries and other ecosystems because nobody will rewrite them just because a new language came by with hype. That includes Android even though Google officially supports Kotlin.

Ofcourse, Scala and clojure are exceptions.

No, but you may grow to appreciate Java in the process.

I also learned Kotlin to avoid Java which I hated since university. A few years later I now have a much deeper understanding and respect for Java, JVM, and the broader ecosystem.

Kotlin/Native exists, but, it's immature compared to Kotlin/JVM.

So it really depends on what you mean by Java - the language or the VM/ecosystem/toolchains. If the former, yeah you don't have to care about it (you have to be able to read it at least a bit). If the latter then you'll find it frustrating. The JVM is theoretically optional but practically required as otherwise you won't have access to enough libraries. The C ecosystem just isn't competitive.

I've done 5 years of Java and Kotlin each. I don't see the attachment to Java. It seems like the only argument for learning Java is having to deal with legacy code. But Kotlin proficiency brings some Java literacy.

Under the same logic, you might as well learn JS and C++ because you'll have to eventually deal with that.

>Can I use Kotlin today without knowing/caring about Java?

Yes, if you don't have to use Java dependencies, otherwise, a little.

You can absolutely use Kotlin without having to write Java. I worked on multiple Kotlin multiplatform projects for four years and never had to do anything in Java. Yes you use libraries that are written in Java but you often won't be able to tell. Kotlin is pretty seamless.
If you have an interest in learning different typed languages, I would suggest F# rather than Kotlin. If you just want to get stuff done, Kotlin is a fine choice. To expand your horizons and don't mind walking a non-beaten-down path, F# may be more enlightening.
Every jvm language, although different, has so many similarities to Java, that I don't see how you can "not know" or "not care" about it.

Sorry, not possible.

Do it!! Ignore any other opinions here and start using Kotlin. The language is fantastic and I've rarely used a technology that I've had so few complaints about
Yes, sometimes you would need to read java code but nothing extreme. Kotlin really is just a better Java
> Can I use Kotlin today without knowing/caring about Java?

Yes.

Short answer: no.
Crystal language is typed.
just fastforward to rust

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal