7 ms·
Honest question. I have been checking Kotlin since a while but haven't found a compelling case for me to start using it. All the features I have seen so far are
by pmelendez 9y ago
Honest question. I have been checking Kotlin since a while but haven't found a compelling case for me to start using it. All the features I have seen so far are syntactic sugar.
Even the article quote something around those lines: “The syntax for Kotlin, like Apple’s Swift, is clean and modern. The reaction amongst developers learning Kotlin is not dissimilar to the initial experiences with Ruby years ago. The syntax is so intuitively designed that even without any previous exposure it’s almost possible to guess it.”
The question would be: Am I missing something? Is syntax the only reason that makes people excited about it? or are there any new abstractions/ideas that are exclusive for Kotlin?
- jarym 9y agoDepends on your definition of syntactic sugar - for instance, the coroutines stuff is very intuitive and makes code far more readable and easier to work with. It all compiles down to stuff that a Java decompiler will be able to read back to Java. But that's just one example and a subjective one at that. Not everyone will feel the same way and for those who don't there's no compelling reason to 'start using Kotlin' - if what you have works then stick with it. There's also Kotlin native and Kotlin JS - allowing Kotlin code to be compiled to native binaries as well as to javascript is pretty compelling and will (imo) pay dividends. Both are still very much in development though.
- lmm 9y agoTo have a clean/nice/familiar syntax in a language with a semi-decent type system is actually a pretty big deal. What're the other options? Java and C# are pretty cumbersome, Haskell and OCaml (and to a certain extent F# and Rust) look weird, Swift/C#/F# are to a certain extent tied to proprietary platforms, and while Scala actually has a nice core syntax the culture of its libraries tended to hide that away under a pile of sigils.
- pron 9y agoWhat feels cumbersome to some may not feel cumbersome to others, or they may not care as much about this, because, for example, they can feel that concrete code is less important than design, and considering that a minor reduction (at best) in the time spent working with code translates to negligible (or even negative) overall contribution to the project, and may certainly not justify sacrificing the many other conveniences that come with using a hugely popular, familiar and well-tooled language.
- kumarvvr 9y agoI can't really pinpoint it, but somehow C# dosen't seem so cumbersome as Java. Perhaps it's the libraries.
- wvenable 9y agoC# isn't as cumbersome as Java.
- pankajdoharey 9y agoThere is none, it is a bad copy of Scala, written by some people who didnt want to write Scala the way it is written and hence thought of inventing Scala again albeit a little differently.
- pron 9y agoThis syntactic sugar makes a big difference for some people, and not so big for others. It's largely an aesthetic choice.
- taesis 9y agoAFAIK, it's popular on Android because it provides e.g. Java 8 stream-like functionality without needing support for that baked into ART, which is something. Additionally, it supports compilation to Javascript [3] and early support for JVM-less execution ("native") [4]. No new abstractions or ideas, though; the language designers were aiming to make something that formalized current best practices, not lay down new ones. Beyond that, it's nothing that you couldn't cobble together without the standard Guava + Commons + Lombok + Quasar/EASync etc. libraries and plugins that you'd use on every project written in Java, as well as that terseness you mentioned that makes people excited (see Kotlin data classes [1] vs Lombok data classes [2], if/try returns values and destructuring [5], coroutine support for lightweight threading and generators [6], null safety w/o optionals and smart casting, etc. [7]). In my opinion, it's hard to know what value those features provide without actually trying them out yourself. If you want to be certain that you're not missing something, I'd suggest writing up a little script to try out some of its features. edit: Just noticed the other responses on this thread. It's also very useful for starting fights with Scala developers, apparently. [1]: https://kotlinlang.org/docs/reference/data-classes.html https://kotlinlang.org/docs/reference/data-classes.html [2]: https://projectlombok.org/features/Data https://projectlombok.org/features/Data [3]: https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-j... [4]: https://kotlinlang.org/docs/reference/native-overview.html https://kotlinlang.org/docs/reference/native-overview.html [5]: https://kotlinlang.org/docs/reference/control-flow.html https://kotlinlang.org/docs/reference/control-flow.html [6]: https://kotlinlang.org/docs/reference/coroutines.html https://kotlinlang.org/docs/reference/coroutines.html [7]: https://kotlinlang.org/docs/reference/null-safety.html https://kotlinlang.org/docs/reference/null-safety.html
- mateuszf 9y ago> Am I missing something? Is syntax the only reason that makes people excited about it? That with combination of precise refactorings, unlike in case or ruby. And without unnecessary complexity of scala.
- jimbokun 9y ago"All the features I have seen so far are syntactic sugar." Programming languages are basically nothing but syntactic sugar over machine code.
- pmelendez 9y agoThat's a bit of an oversimplification. I would argue that anonymous functions, first-order functions, lambdas, macros that modify ASTs are not syntactic sugar but features of a language that contribute with the expression power.