4 ms·
Hmm 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
by jmfldn 5y ago
Hmm 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.
- jmfldn 5y agoIt does require discipline, or at least one person on the team who can set a style guide for the newcomers to follow, this is true.
- grogs 5y agoScala 3 somewhat simplies implicits by the way. Especially w.r.t to extension methods, which are now a first class construct in the language: https://docs.scala-lang.org/scala3/reference/contextual/extension-methods.html https://docs.scala-lang.org/scala3/reference/contextual/exte...
- perl4ever 5y ago>The truth of it is that Kotlin is incredibly easy to learn That's not my truth. I tried it, after not doing "real" programming for a while, and found it the most obfuscated, incomprehensible language I've ever run into. What new concepts are there in Kotlin that justify it? "Expressiveness" sounds toxic to me - along the lines of "facilitates a personal idiom that makes your code impossible to understand and you irreplaceable". After several days trying to do the simplest form of asynchronous processing in an "hello world" Android app, I switched back to Java, and everything made sense again. I also wrote a small program in C# and that too was just as easy as I recall from ~10 years ago.
- EdwardDiego 5y agoKotlin can be written very densely indeed. It's a bit like Scala in the regard that disciplined usage is necessary (although nowhere near as bad, no implicit conversions/parameters, restrained operator overloading). But then, I've seen some shit Java too.
- jpgvm 5y agoYeah I'm not going to argue that Java and C# aren't smaller languages than Kotlin, they definitely are and I like/appreciate both. I'm surprised you feel Kotlin is incomphrensible though, it definitely can be written that way because it has features that allow for extreme terseness. I think there is a minimal set of things you need to learn over Java for Kotlin to make sense, nullability operators, block passing syntax and the differences in OOP (inheritance/interfaces are slightly different, classes are closed by default, companion objects replace static methods). So yeah. Kotlin is strictly larger than Java so it takes longer to learn all of it. That said because of the look and feel of Kotlin it's more accessible to developers of Ruby/Python/JS/Typescript. This tradeoff is personally worth it for me. Not because I care that much, I can just as easily use Java. However it's -very- difficult in modern times to convince my team and company to use Java when there is hipster options like Typescript taking all the air out of the room. Kotlin competes in the same area but provides the same battle tested runtime and excelent libraries, it's almost like a compromise between the new age and the old age. This is why it's such a great language for me in particular but I realize not everyone is in the same boat.
- lmm 5y agoKotlin is easy to write because every idiom is available - but calling that a low barrier to entry reminds me of how articles used to suggest Perl as a beginner language because it was expressive. I actually consider it more complex than Scala as a language, because a lot of complex Scala idioms are just library code that you can click through to, whereas Kotlin tends to implement them as part of the language. I fear for the people who will have to maintain large enterprise Kotlin codebases in 5-10 years' time. SBT is inexcusably awful (and so is ScalaTest, which is a lot of people's first exposure to the language), and you might be right about the zeitgeist having moved on, but it's a shame; it's honestly a significantly better language design.
- cageface 5y agoWhich big companies are adopting Kotlin on the backend?
- 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.