5 ms·
My advice - go with Kotlin. You get the JVM, all of the Java ecosystem, type checking (of course), and a sane, modern language.
by smallerfish 4y ago
My advice - go with Kotlin. You get the JVM, all of the Java ecosystem, type checking (of course), and a sane, modern language.
- rattray 4y agoKotlin may have many advantages over Python as a language (subjective), but the Java ecosystem is not an attraction over the Python ecosystem to me (both have flaws, but the Java world has a lot of bloated stuff)
- mardifoufs 4y agoWhy not just java? I thought it caught up to kotlin in the past few years
- cutler 4y agoHardly. Despite the introduction of raw string literals Java still can't handle a regex without having to double-escape metacharacters.
- germandiago 4y agoHow can you even say this? Regex is very specific. It has added records, streams, virtual threads (preview I think) working with native better, pattern matching... Java is like C++. Everyone talks bad about it but at the end of the day it is one of the most Getting things done language. I am not sure why I should use Kotlin. Llokd nice! But for sure docs and support are not even close to Java.
- alex_suzuki 4y agoAre you seriously comparing Java to C++? One excels at helping you shoot yourself in the foot. The other gets things done…
- sk0g 4y agoWith the passionate hatred both languages inspire, I'm not sure which is which in your statement. One could argue C++ gets even more done, since it is appropriate for use in more contexts, like firmwares/drivers, native SDKs, games, etc. Java's main use cases have strong competition in languages like C#, Go, C++, Python, etc.
- replygirl 4y agowhich is which lol
- germandiago 4y agoI see you have not used C++. Let me tell you that with all its quirks, it can do way more than any language low-level wise and go back to high level. Of course some people just rant about it. But did you guys use it a span of time long enough to really know how good or bad it is actually?
- smallerfish 4y agoThe gap has closed somewhat for sure, but there's still quite a few nice features in Kotlin that Java doesn't have. https://gist.github.com/makosblade/8fb1f577d81f02025784093d25ec1303 https://gist.github.com/makosblade/8fb1f577d81f02025784093d2... does a good job at identifying most. I'd add the semantics around lambdas are much nicer better in Kotlin.
- 5e92cb50239222b 4y agoBecause that's what the cool kids use. After using Kotlin in Spring projects for a couple of years, I rewrote most of it to Java 17 and stick to Kotlin strictly in Android work. It's not that much different anymore with all the recent additions to Java, and as Java progresses (and the main JVM implementation which is first and foremost being developed for Java) and diverges in other directions in some very important areas (value types, Loom), Kotlin starts to feel more and more like a second-class citizen. I mean, that's what some old-timers were preaching right here on HN from the very start. Things like Hibernate require some pretty ugly (IMHO) hacks to work properly (you need something like three compiler plugins, and spread keywords around like there's no tomorrow). The compiler was also very slow compared to Java. The same amount of code written in the same style took 2× times to build. This may have improved. Probably the only thing I miss are nullability annotations (after getting used to them in C#, not Kotlin). Edit: after re-reading what I wrote, the tone feels way too critical. Kotlin is a nice language, and certainly easier & more fun to both read and write (although it's trivial to write unreadable mess by going too far with its features). It just doesn't go far enough (for me) to warrant using a separate language with all that entails.
- throwaway2037 4y agoYou raise an interesting point: Maybe Kotlin was the push Java core devs needed to increase their rate of innovation ("release cadence"). I saw similar with Netscape vs IE, Chrome vs IE, Clang vs GCC, Boost vs C++ foundation library, .NET vs Java, Java+.NET vs C++, Node vs Deno. Kotlin can continue to experiment with new and interesting language features. Those that prove most popular can be adopted by Java. Also, as a secondary effect, since Jetbrains wrote Kotlin and had the best IDE, they had a head-start to build the community. That also helped to sell more IDE licenses. (I have nothing against this 1980s spy movie "master plan": They are great company with many great products.)
- rattray 4y agoKotlin remains a way better language IMO. Java has adopted maybe 20% of the things that make Kotlin better, but due to backwards compatibility it'll never catch up. Personally I think it'd almost never make sense to adopt Java over Kotlin for any greenfield JVM project, unless the devs you hire are truly so low-skill they can't pick it up.
- ghostwriter 4y ago> Java has adopted maybe 20% of the things that make Kotlin better, but due to backwards compatibility it'll never catch up. Kotlin supports neither structural pattern matching nor guarded patterns as they are available in both Java 18 and Scala. It's Kotlin that needs catching up nowadays.
- ackfoobar 4y agoIn Java 18, this is the pattern matching you're talking about. `if (o instanceof String s) {` Not much benefits over Kotlin's smart casts. Guarded patterns with this version of pattern matching should be translatable to adding another "and" condition. The Kotlin compiler should have no problem reasoning with that. --- I find positional destructuring in Scala (which works similarly in Java 19) a bad design. https://news.ycombinator.com/item?id=31399737 https://news.ycombinator.com/item?id=31399737
- seanw444 4y ago> nowadays It's an abstraction atop Java. Of course it plays the catch-up game. It inherits new features from Java. They can't have it instantly.
- ghostwriter 4y agoWhat's the point of Kotlin, aside absence of semicolons and the 'val' keyword, if it plays the catch up game with the rest of the features becoming available first in Java? > They can't have it instantly. Why not if Scala did it way before pattern matching was introduced into Java?
- Akronymus 4y agoKotlin seems like a pretty good choice. To me, it looks essentially the same as F#, just on the JVM rather than CLR.
- fredrikholm 4y agoCould you elaborate? To me these are (idiomatically, syntactically) two very different languages.
- Akronymus 4y agoIt seems like I only took the most surface of looks at it. And maybe mixing it up with scala a bit. That's what I get for not reading about it more carefully.
- cutler 4y agoMaybe with Arrow but by itself Kotlin is still mainly object oriented.