12 ms·
Scala was nice when it was the only alternative to Java but Kotlin has been slowly gaining some pretty solid momentum as a candidate for Java's replacement.
by incepted 11y ago
Scala was nice when it was the only alternative to Java but Kotlin has been slowly gaining some pretty solid momentum as a candidate for Java's replacement.
- eklavya 11y agoAssuming it's really gaining momentum over Scala I won't understand why. What Kotlin has over Scala? Compile times? After coding for 1 hour I compile once to check if Intellij and I missed something. Are those 3-4 minutes too much time?
- pjmlp 11y agoRight now, I would say the only thing it has is momentum on Android, given JetBrains relation to Studio. Using Scala on Android requires a bit more tinkering with ProGuard than Kotlin does, and it isn't a focus of the Scala designers. Also with Scala 2.12 going Java 8, one will be stuck with 2.11 for Android.
- merb 11y agoNo Android will switch to newer OpenJDK so Scala 2.12 would be a valid target.
- pjmlp 11y agoSpend some time reading the Android source code. According to Jake Warton, they only cherry picked some parts of OpenJDK 7. From the commits they also don't appear to ever fully support Java 8, only lambdas.
- merb 11y agoever is a strong word. I know that at the moment they use some parts of OpenJDK 7, but If they need to comply the Java (tm) caused by licensing, they will be forced (sooner or later) to actually don't use a deprecated JVM. As I know OpenJDK will be depracted on 2024. so it will take some time, but it will come.
- pjmlp 11y agoGiven the rumors of ChromeOS and Android becoming one OS, by 2024 it will hardly matter.
- lmm 11y ago2.12 doesn't include any (non-gated) changes though, so you can keep the same codebase and cross-build for 2.12 (for performance) and 2.11. So we're talking what, at least 3 years ("Aida", either 2.13 or 3.0) before Java 8 becomes a blocker for source-level features, at which point I imagine Android will have an answer.
- pjmlp 11y agoI doubt Google team will change, given their attitude regarding Java 8, as demonstrated at both Google IO 2014 and 2015. Also the way they are cherry picking features from OpenJDK 7 and some kind of lambda support. For me, Android Java has become similar to Symbian C++ in terms of dev experience and language fork.
- reality_czech 11y agoWell, that's the thing. If you have a small amount of code, the compile times are never a problem. Try compiling something like Apache Spark. It will be somewhere between 30-60 minutes depending on your disk speed, CPUs, etc. etc. The incremental builds are faster, but never less than 2 or 3 minutes for any change. You could potentially avoid this with the REPL, or use inotify to trigger a background compilation, but none of those really works all the time.
- eklavya 11y agoAnd yet it was written in Scala. That shows how little the compile times offset the goodies of using Scala.
- reality_czech 11y agoAt the time Spark was started, Java didn't have lambdas or closures, making the equivalent Java code for functional-programming-style ML code much more verbose. Whether the same decision would be made today is an open question (and probably depends on who you ask). A lot of other frameworks have made different decisions, such as keeping the core of the project in Java and supporting other languages as shims on top (in my opinion a more sensible decision...)
- airplane 11y agoFrom what I observed it's close enough to Java that people can easily switch and are willing to. There's also enough brevity with the language to be at ease with it daily (not as much as Scala) where it may be enough that perhaps people might not want to invest time to go all the way to Scala.
- lmm 11y agoOne of the things I love about Scala is that you don't have to "go all the way" though - you can start by writing Java-like code using Java libraries, and move on to writing Kotlin-like code as and when you want to, and move on to more advanced features than that as and when you want to.
- incepted 11y ago> One of the things I love about Scala is that you don't have to "go all the way" though This is true of any language so it doesn't mean much. Still, we went through the same thing with C++ 20 years ago. Google even used to have (still does?) a style guide saying which features to use and which ones not to use. Instead of having to use a guide that tells me which features of a language are dangerous, I prefer a language that doesn't require such a guide in the first place.
- lmm 11y agoUnfortunately it's impossible to combine that with seamless Java interoperability, because so many Java features are dangerous (null, exceptions, pervasive mutability, all of the methods on Object, finalizers, low-level thread manipulation) or at least cumbersome (use-site variance and the resulting existential types, control flow constructs built into the language syntax). I don't think there are any dangerous things you can do in Scala that you can't do in Kotlin. Only safe alternatives that exist in Scala but not in Kotlin.
- pjmlp 11y ago> Google even used to have (still does?) a style guide saying which features to use and which ones not to use. Which is a good example on how not to write modern C++, given the things they don't allow to use and not loved that much in the C++ community.
- incepted 11y agoTo me, the benefit is what Kotlin has less than Scala. It's an incremental improvement over Java and it fixes exactly all the complaints I have over Java and nothing more. Also, its IDE support is just as good as Java. But the language is not even out officially, let's see in five years how it fares. Right now, it's just a breath of fresh air over Java.
- ninjakeyboard 11y agoIt's worth noting that typesafe are prioritizing reducing compile time but it's a 32 pass compiler (!) We're working on gigantic production systems currently and with good modularization compile times are not a problem for us.
- pjmlp 11y agoHere in Germany I am yet to see any job posting about it. It is all about Java, Scala and Clojure.
- airplane 11y agoWell Kotlin isn't even officially released yet (1.0 candidate came out last week) so no company is probably using it for production yet.
- incepted 11y agoAnd even after that, it wouldn't be reasonable for any big company to adopt a language that's not at least at version 1.1 or 1.2. I don't think one can make any pronouncement about Kotlin's success or failures for several years.
- hannes2000 11y agoI wouldn't be so sure. A bunch of Android developers are severely hurt from being stuck with Java 7. I'd expect many production apps to be written in Kotlin pretty soon, about as fast as the switch from Objective-C to Swift went.
- pjmlp 11y agoScala is also an option and currently looks better on the cv. This will of course improve for Kotlin, specially if they get some Google blessing. EDIT: Also forgot to mention that on Swift's case, it is a first class language being pushed by the platform's owner, not a 2nd class language without any kind of consideration from the platform SDK.
- EdwardDiego 11y agoIt's a trivial conversion from Java to Kotlin, as opposed to Scala or Clojure, so I wouldn't expect people to be hiring explicitly for it. And the fact that 1.0 RC was just released this month might tell you other reasons why. How many Scala jobs did you see advertised when 1.0 was released in 2004?
- lmm 11y agoI'm tired of the Kotlin hype (particularly with it unreleased, and so rarely used in production). Many of its features are already part of modern Java, and its language features are very ad-hoc. I can easily see a future for Scala (it offers more radical improvements that Java will never adopt), and maybe see a future for Ceylon (it's a very clean design and the union types are a genuine innovation). I can't see one for Kotlin.
- incepted 11y ago> I'm tired of the Kotlin hype (particularly with it unreleased, and so rarely used in production) You call it hype, I call it enthusiasm. But regardless of the names we use , what I find very interesting is that Kotlin is generating such positive feelings even though it's not even 1.0. I haven't seen this happen for languages in a while (probably "ever"). What's also striking is that most of what I read about Kotlin is positive, and again, languages hardly ever generate positive feelings so widely across the board.
- lmm 11y agoDo you not remember when Java itself came out? The positive feelings ring very false to me. Kotlin has announced a lot of features long before they were delivered, and taken a lot longer to deliver a working language than they originally claimed. It's the old "two types of languages" - most languages sound good when you talk about their features, it's only when you actually use them that the negatives become apparent. I don't know anyone who's actually used both Kotlin and Ceylon and prefers Kotlin, and Ceylon is actually more mature (1.2 released recently, IIRC). But since King only advertises features that are actually implemented and release dates he can actually make, there's a lot more hype for Kotlin.
- EdwardDiego 11y ago> I can't see one for Kotlin. You can't see a future for a language that offers far more succinct code than Java, but maintains the ease of Java?
- 11y ago