25
points
I would like to learn a new typed language. C# was the first language I learned back in 2008. Since then I've been using a slew of languages, mainly Ruby and Elixir.
Can I use Kotlin today without knowing/caring about Java?
Can I use Kotlin today without knowing/caring about Java?
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.
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.
aside from nullability and a few conveniences, what are some examples that really push it over the top for you?
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.
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.
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
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.
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.
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.
Under the same logic, you might as well learn JS and C++ because you'll have to eventually deal with that.
Yes, if you don't have to use Java dependencies, otherwise, a little.
Sorry, not possible.
Yes.