Live data from Hacker News

Kotlin, the Swift of Android

blog.gouline.net

51–60 of 114 posts

Re: Kotlin, the Swift of Android

#51
I tried Kotlin to write the first version of a small internal application used at the company I work at. On the plus side is IDE support and the fact that you can mix and match Kotlin with existing Java code.

In the end though, I found the syntax "funny" in some places and slightly less verbose than Java but not enough to justify using it. The underlying Android API is so verbose that Kotlin by itself is nearly useless.

We ended up dropping Kotlin and rewriting the thing in Java. In terms of lines of code both versions are nearly the same.

Re: Kotlin, the Swift of Android

#52
post #13

Earlier quoted context omitted.

Java 8 does introduce a few features that are available in Kotlin, but AFAIK Java 8 won't be available for Android for some time. In addition, Kotlin makes a lot of constructs more succinct, including but not limited class definitions. So it's not only about what it adds, but what it "takes away" too IMHO.

> AFAIK Java 8 won't be available for Android for some time Pretty sure it will never be available on Android. Best case scenario Google moves away from it. Worst case, it will add some new, similar features to Dalvik VM. But I doubt they are considering adopting Java 8.

Do you have any basis for these claims? Java 8 contains many useful language improvements and Google has shown with Java 7 that it will adopt these (albeit incredibly slowly)

Re: Kotlin, the Swift of Android

#53
post #35

Earlier quoted context omitted.

For C# devs, Xamarin is a good choice I believe, despite being paid.

I've had opportunity to play with it (at work), but given the price, not a likely choice for my hobby projects. It's not without its drawbacks, either. Since it's not native development (for Android), we 'e adding more moving parts into the equation. And, for instance, most of the sample apps for Xamarin.Forms wouldn't even build when I tested Xamarin. I had to fix folder paths (to Android SDK) manually. The product…

Xamarin Forms is really new. Xamarin Android(Accessing native Apis via C#) is quite stable.

Re: Kotlin, the Swift of Android

#54

Earlier quoted context omitted.

How do you come up with 11 MB? Even the whole library jar file which is much more than just the runtime is only 5.5 MB. But even then it doesn't matter anyway. Android apps are ProGuarded before deployment (regardless of the language used) and the overhead in Sclaa's case is a few dozen kBs.

The less code has to be converted to the DEX format, the better. Sure, build tools have improved somewhat (incremental DEX compilation comes to mind) but, still, every time I pull in some rather big (~1 MB) .jar file in my project I get noticeably longer build times for non-production builds. With a 11 MB dependency, even production builds take considerably more time to complete and that gets in the way when you want…

There. Is. No. 11. MB. dependency.

And even if there was, it wouldn't matter because it would be done once and then deployed directly on the development device.

Really, can we just stop making stuff up?

Re: Kotlin, the Swift of Android

#55
post #52

Earlier quoted context omitted.

> AFAIK Java 8 won't be available for Android for some time Pretty sure it will never be available on Android. Best case scenario Google moves away from it. Worst case, it will add some new, similar features to Dalvik VM. But I doubt they are considering adopting Java 8.

Do you have any basis for these claims? Java 8 contains many useful language improvements and Google has shown with Java 7 that it will adopt these (albeit incredibly slowly)

It has only adopted Java 7 features which are either syntactic sugar or library extensions. (E. g. everything where the Java class file version wouldn't have mattered anyway).

Java 8 (and Java 9 and Java 10) are completely different, with huge, mandatory changes to the class file format and the virtual machine.

Re: Kotlin, the Swift of Android

#57

Swift has algebraic data types and pattern matching, this doesn't. It just seems to be Java with a paintjob and some bells and whistles tacked on. I don't see the point of such a timid new language.

literally the third sentence: "For the desperate and adventurous there are the JVM alternatives like Scala and Groovy, but using them with Android is expensive: importing a language means importing the whole runtime, which is a nightmare for the package size and method count"

Re: Kotlin, the Swift of Android

#58
post #13

It would be nice if more of this was folded into Java itself, rather than existing as a new language - as the author notes a lot of it is in Java 8.

Java 8 does introduce a few features that are available in Kotlin, but AFAIK Java 8 won't be available for Android for some time. In addition, Kotlin makes a lot of constructs more succinct, including but not limited class definitions. So it's not only about what it adds, but what it "takes away" too IMHO.

Kotlin could be the Swift for Android if Jetbrains make it an explicit goal and gain developer mindshare.

Also, Kotlin can compile down to JS and can thus target another Google platform - ChromeOS/Chrome - with the possibility of shared code.

Re: Kotlin, the Swift of Android

#59
post #7

I have been fiddling with Kotlin for last few days. It is trivial to get it working in Android Studio, which is a plus already. It's not nearly as verbose as Java, and for one thing, it gives me LINQ that I've been missing from C#.

Wait, there's and Android-compatible language with LINQ-like queries?

BRB, converting my entire codebase.

Re: Kotlin, the Swift of Android

#60
post #26

Earlier quoted context omitted.

Oh, thanks for the correction. I had assumed that JetBrain develops Android Studio and Google just puts their stamp on it.

Well that pretty much is what happens. JetBrains wrote IDEA and the Android support for it. Google made some small modifications (some good, some detrimental), and packaged it with the Android SDK. The biggest change was to switch to gradle which is a more powerful build system but also much buggier (at least in the current Android Studio). They also lots of useful Android-related tools and lints, and a fair helping…

Only when it offers better support than CDT for the NDK and all those Grandle bugs get properly fixed.
Post reply on HN