5 ms·
To be honest I see Kotlin continuing to exist because of it's multi-platform nature and it's focus being on different things to Java. So even if feature wise t
by jpgvm 5y ago
To be honest I see Kotlin continuing to exist because of it's multi-platform nature and it's focus being on different things to Java.
So even if feature wise the 2 equalize (a good thing not a bad thing IMO) stylistic differences will remain. Many of Kotlins syntactic differences are unlikely to make it to Java for instance.
I'm ok with this. I use both for different things. Kotlin for most app level development, Kotlin for libraries that are only useful in the context of Kotlin, Java for everything else so it has minimal dependencies and can be used from Kotlin/Scala/Java/Clojure equally well.
- jmfldn 5y agoHmm yes I guess you might be right given Android. It's a shame in a way that Kotlin was invented as Scala could have filled the niche too imho but that ship has sailed. It's too similar to both Java and Scala and doesn't really bring anything new to the table. Is that fair or does it have a great USP other than massive Google backing?
- jpgvm 5y agoI don't think Scala ever could have filled that niche, I say this as someone that wanted Scala to be successful. The truth of it is that Kotlin is incredibly easy to learn, even for non-Java devs. It is definitely focused on a very low barrier to entry. I don't think this was an original goal but it's become a significant focus of the language especially after being selected to be the next platform language for Android. This isn't true of Scala at all. Beyond things like SBT, comparatively poor IDE support (less of an issue these days) it is also just a very complex language, with many complicated semantics in it's standard library and even more complex/fancy 3rd party libraries piled on top of that. Scala became an incredibly powerful language, not a simple or easy to use one however. Kotlin is a very user friendly language that is easy to learn but still has enough power to keep most expressiveness focussed devs happy. Beyond the learning curve Kotlin integrates with Java a lot better, calling in both directions. These 2 factors alone probably account for why it was chosen over Scala for Android and in general why it has value over both Java and Scala. I think with Gradle moving from Groovy -> Kotlin, Android obviously and big companies adopting Kotlin w/Spring on the backend the ship has indeed sailed for Scala, it doesn't really have a place outside of places that specifically want a more FP lang.
- jmfldn 5y agoI hear this a lot about Scala, and I am a Scala dev so maybe I'm biased, but I don't get the difficulty angle particularly. I'm in no way exceptional as a programmer or IQ-wise but I picked up Scala easily as part of my first job. The difficulty thing doesn't compute to me but it could just be that I'm well-suited to the language. It works beautifully as a better Java if that's how you wish to use it. Granted, it might be hard if you start with a "pure FP" codebase but most devs don't struggle picking things up on most code bases even as juniors. The point about tooling and developer experience I'll concede. It has been at times patchy in Scala in the past but it's pretty good these days. As I say, I have no hate for Kotlin, and I'll possibly use it one day being a JVM developer familiar with Java as well, I just find it unfortunate that a language which is so similar to the languages it's influenced by was invented.
- grumpyprole 5y agoThe first time I tried Scala, I got a type error based on the result of an implicit conversion, which succeeded locally but not for the entire expression. It took me a while to figure out what had happened. Advanced (mis) features such as this combined with encoding everything into objects with subtyping make Scala very complex. F# and OCaml are examples of much simpler languages that have most of the advantages (albeit no JVM).
- kaba0 5y agoImplicits were majorly revamped in Scala 3, so do give it a look if you hadn’t already!
- jpgvm 5y agoIt's difficult because the language is gigantic compared to Java, it has all the OOP bits Java has (and Scala needs in order to be relevant) then a whole bunch of FP stuff on top. This is a lot for newer programmers and while they might be able to do "hello world" equally quickly I do feel like they soon hit a wall of "I don't understand why this works" when looking at idiomatic Scala. It can be used as a better Java but requires discipline. Things like implicits can easily cause an unnecessary amount of pain. Kotlin on the other hand implemented extension methods in a way that doesn't detract from the better Java paradigm. This is only one example though, there are many many reasons why Kotlin is more suited for the "better Java" role. Namely it's simply not that different to Java. It's effectively Java with a more modern syntax and polished extensions to the Java standard library.
- grishka 5y agoYou could soon be able to use modern Java on Android, too. Remember that most of the new syntax features don't need changes to the JVM.