
Google scored points with its community by supporting Kotlin - steven
https://backchannel.com/the-language-that-stole-android-developers-hearts-807fdbf07c2a
======
slackingoff2017
Kotlin is exactly what Google needed to light a fire under Oracle's ass.
They've been dragging their feet on new Java features for years. That, and the
constant threat of Oracle closing Java back up as they're doing to MySQL.

The backlash against jigsaw may turn out to be justified. "Modularizing" the
JVM would be exactly what you would expect as a first step to making some
parts proprietary. If Oracle can wall off parts of the JVM completely they can
claim GPL exemption for these parts and start closed source development of
"enterprise" level features.

Kotlin will do a lot to derail attempts to make Java proprietary. Since it
works fine on Java6 JVM's it sends a strong signal to Oracle that "we don't
need you, if you piss us off we'll just fork the language".

~~~
davidf18
Why not code generate to LLVM which is superior to JVM. Why not make a JVM to
LLVM converter as well as a JAVA to LLVM?

~~~
tanilama
> LLVM which is superior to JVM

Link? Superior in what way? Is there any LLVM based JVM implementation that
runs faster than the current JVM android is using and no compatibility issue?

When I see those claims without any actual code, I would stay suspicious and
call it farce, until it proves itself.

~~~
DannyBee
"Link? Superior in what way? Is there any LLVM based JVM implementation that
runs faster than the current JVM android is using and no compatibility issue?
"

Yes. Azul uses LLVM as its last tier JIT compiler now :)

I don't think anyone is going to argue they don't have the fastest JVM around.

See [http://www.infoworld.com/article/3193078/java/azul-
introduce...](http://www.infoworld.com/article/3193078/java/azul-introduces-
llvm-compiler-to-java-runtime.html)

The performance numbers they give are: " Falcon bests Oracle's HotSpot Java
platform by anywhere from 5 to 250 percent in production performance,
depending on the application, according to Azul. "

~~~
tanilama
And you forget to quote: > Based on the LLVM compiler platform, designed for
server workloads, and optimized for recent Intel and AMD architectures

Server and mobile application have vastly different assumption of workload and
metrics to take a look at. However, this announcement definitely better than
OP's vague performance claim, which I agree. But as I said, there is no proof
at this point, that LLVM based implementation on _Android_ improve the the
performance.

Quite on the contrary, Google include LLVM in 5.0 then remove it later:
[https://www.quora.com/What-are-the-technical-details-of-
the-...](https://www.quora.com/What-are-the-technical-details-of-the-Android-
ART-runtime-introduced-in-Android-4-4/answers/10044855?srid=XwOv)

And it was never used as the primary option anyway. So there is definitely not
enough confidence to claim the superiority, until somehow _make_ it work in
the first place.

------
alexandros
TL;DR -- because developers love it. I clicked the article hoping there was
some strategic background, some connection to the Oracle lawsuit, etc. Nop,
the answer to "why" is "because of its merits". Also in this article, some
backstory about the name "Kotlin".

~~~
darwhy
I wonder if the hn gods will change the title from "Why supporting Kotlin is
genius move for Android" to something less sensationalist. Maybe not, as it's
being posted by Steven Levy himself.

~~~
giancarlostoro
They will likely change it to what the article's title is.

------
jarym
The language is indeed very nice but really key things that make it so nice
are also:

1\. The IDE support (without it, it would be somewhat more painful)

2\. The fact JetBrains have built a really great new syntax and still have it
compile down to regular java bytecode - and bytecode that isn't a total
nightmare (I'm looking at you Scala!)

3\. JetBrains use it themselves for their own suite of commercial products
(mostly code editors) - this made me feel like it was less likely to become a
toy language.

4\. The fact that coming from Java it is absolutely painless - familiar
syntax, automatic code conversion that works well for the most part, and full
interop with Java.

~~~
smt88
Can you say more about what you dislike about compiled Scala?

~~~
jarym
In order to implement all the Scala language magic the generated byte code is
sometimes far away from what the equivalent Java code byte code would look
like.

This isn't a problem for most people but it is an issue for anyone who uses
stuff like byte code instrumentation - take a look at this issue for example:
[https://github.com/puniverse/quasar/issues/45](https://github.com/puniverse/quasar/issues/45)

It's not a criticism of Scala (the language is just a LOT richer so has to
cater for more sophistication).

But the difference matters to me which is why I prefer Kotlin over Scala and
I'm prepared to miss out on some of that sweet Scala magic.

------
Ralfp
> In the early 1700s, Peter the Great, the czar of Russia, was busy nabbing
> land from his western neighbor, the Swedish Empire. He seized the tip of the
> Gulf of Finland, and began building his beloved city of Saint Petersburg
> there. He also secured a small island just off its coast as a naval defense:
> Kotlin.

> Peter couldn’t have known that more than three centuries and 5,500 miles
> removed...

However, if you are from eastern Europe, chances are you've ran into large
brand of tomato products known by same name:

[https://maspex.com/files/pl/news_spotlight/file_57502ce3e538...](https://maspex.com/files/pl/news_spotlight/file_57502ce3e53816450428143.jpg)

;)

------
tanilama
Exactly this. So tired of these self-entitled feeling-smart conspiracist
unnecessary interpolation of unrelated events, e.g. Oracle lawsuit, Google's
agenda blahblah.

Kotlin is already popular in Android dev crowd. That is the one and foremost
factor that why Google _would_ support it. Because there is already a
community and a robust toolchain(Thanks to Jetbrain) over there. It is a low-
hanging effort for Google to claim by simply signaling a gesture with very
little to commit really.

------
sandGorgon
Kotlin is already quite popular in the Android community. I would actually
point out that it is the engineers at Square (like Jake Wharton) that gave
Kotlin it's early legitimacy.

The Google announcement excites me for reasons beyond Android - I'm hoping
that Google's huge investments in machine learning, play off along with the
amount of investment it is going to do in Kotlin.

I would love to see a whole bunch of server side infrastructural components
built out in Kotlin ... including things like Tensorflow, Spark, etc

More than Oracle, I think this is pretty much the death knell for Scala. When
you have a far more pleasant language, with IDE integration that is mind
blowing, and is supported by one of the largest companies in the world ... And
probably is ALREADY MUCH MUCH more popular than Scala at this point

~~~
lmm
We'll see how Kotlin looks when it's as old as Scala is. They haven't yet had
to make substantial changes while keeping compatibility with existing
codebases; that's hard for any language and much harder for a language that
throws in a lot of ad-hoc special-case features at the language level (which
Kotlin does a lot more than Scala, despite how it might superficially seem).

~~~
izacus
Kotlin is heavily used internally at JetBrains for development of their IDEs.
For years now - those aren't small or easy projects.

~~~
lmm
Just as with a library, evolving a language that's used internally is very
different from evolving one that's used publicly by third parties.

------
zzalpha
You know, I gotta admit, as someone who rather likes Kotlin, even I'm getting
a little exhausted with all the breathless Kotlin articles...

~~~
throwaway7645
Is it really that great? Seems like Swift for the JVM. Sure it's great, but
there are a lot of similar things out there.

~~~
guelo
Fun fact, swift took some of its early inspiration from kotlin.

~~~
alblue
Source? The Swift project's initial commit[1] was 6 months before Kotlin's
initial commit[2], so I fail to see how something started six months earlier
could have taken its early inspiration from a language that didn't exist yet.

[1]
[https://github.com/apple/swift/commit/18844bc65229786b96b89a...](https://github.com/apple/swift/commit/18844bc65229786b96b89a9fc7739c0fc897905e)

[2]
[https://github.com/JetBrains/kotlin/commit/3e4dce385331c91c9...](https://github.com/JetBrains/kotlin/commit/3e4dce385331c91c9059fcdcea3eae2394f34942)

~~~
stoolpigeon
Jetbrains unveiled Kotlin in 2011, it had been under development for a year at
that time. Swift was introduced at Apple's 2014 Worldwide Developers
Conference.

That's what I get at wikipedia for each language.

------
rtpg
I'm glad to see Kotlin support (would love Python support but you can't win
them all)

The Android APIs are still a major problem for me. In web front-ends we've
basically gone full FRP and I'm sitting here with my resource files and 10
line invocations to make a notification.

This is partly because it's necessary for Java, but I'd love to see a first
party API that tries out something a bit more fluent

~~~
BoorishBears
It's not necessary for Java, the Android APIs are just horribly written, and
the notification is a lot more involved than you'd think because it ties into
how the OOM treats your app and the intent system

~~~
rtpg
I think I get why the notification stuff is so complicated (there's a lot of
stuff going on, after all!)

It always feels like Android shipped with the low-level API but forgot to
provider a higher-level API for the 95% case

------
grzm
Actual title "The Language that Stole Android Developers’ Hearts"

------
xaduha
The way I see it - the fact that alternative JVM languages are so underused is
a damn shame. And if it becomes more acceptable to not use Java, then all such
languages will benefit. For many reasons Kotlin is better as a champion of
such a change.

------
bogidon
Probably a silly question, but since Android is OSS, what specifically
prevents parties other than Google from adding "first class" language support?

Does Google not accept (major) external contributions to the build toolchains?
Is it the official documentation that's getting rewritten for Kotlin? Or is
Google releasing Kotlin-ified wrappers for the Android APIs? Maybe I don't
fully understand what new privileges Kotlin is getting.

~~~
pas
Kotlin is getting Google's blessing. Mentioned in Google's Android development
docs and tutorials. That's the magic sauce. Since Kotlin is veeery close to
Java, it was already working well on Android. It targets the JVM of Java6, so
if you compile your Kotlin android app, it looks like a regular thing compiled
from Android Studio. Regular bytecode, that then gets recompiled by dx (dalvik
compiler into .dex bytecode - see also
[https://softwareengineering.stackexchange.com/questions/2852...](https://softwareengineering.stackexchange.com/questions/285235/is-
art-an-installation-process-or-an-os-or-a-virtual-machine) )

And yes, adding new things to Android is ... problematic, because Google
doesn't accept pull requests. (It accepts bug reports, and sometimes patches
of bugs.) And of course you can propose a big patch adding [see
[https://source.android.com/source/life-of-a-
patch](https://source.android.com/source/life-of-a-patch) ] .. let's say Swift
to the Android Platform, but the project owners are Google employees, and the
community cannot really influence what gets accepted. [
[https://source.android.com/source/roles](https://source.android.com/source/roles)
]

~~~
bogidon
Got it. It's a shame that Google has been moving Android in a more proprietary
direction.

Are there any notable Android forks that are more progressive about supporting
new languages? If so, is their market share consequential?

~~~
pas
[https://en.wikipedia.org/wiki/List_of_custom_Android_firmwar...](https://en.wikipedia.org/wiki/List_of_custom_Android_firmware)

Replicant is the most "open".

Also, it's not hard to package all the stuff a language needs and put it into
an APK. It's just messy and there are a lot of "edge cases" and things to work
out (like the problem of interacting with the Platform, you'd need to call
into a "Java" interface from your language, you'd need to run your app inside
ART/Dalvik, maybe fork -
[https://stackoverflow.com/questions/39006044/repeatedly-
fork...](https://stackoverflow.com/questions/39006044/repeatedly-fork-android-
app-process-where-child-can-access-system-services-via) ).

And so if you spend half a year just getting something to run, and on the next
Android version Google makes a change, and bamm, you might get left in the
cold, because security or whatever.

------
fooker
Why is Kotlin a better language for Android dev?

Won't the platform APIs designed for Java look and feel very non-idiomatic in
Kotlin?

~~~
atemerev
No. Kotlin is designed with Java interoperability in mind; it is the language
design top priority (unlike e.g. Scala and Clojure).

~~~
roflc0ptic
As far as I've experienced, Scala has excellent interop with Java. What do you
find lacking?

~~~
throwaway7645
Kotlin is far simpler than Scala which has a big emphasis on functional
programming and OO, so not going to be super popular soon. It's also behind
Kotlin in good ide support. Clojure is simpler, but mainly focuses on
functional programming and is a lisp as well, so will also not be a great
candidate for the masses.

~~~
flavio81
Functional programming has surged strongly in popularity these last couple of
years.

As pointed out, other JVM languages also have "Java interoperability" as top
priority. Clojure does.

Clojure is getting popular lately, why isn't a "great candidate for the
masses"? Because it is a Lisp? During most of the 1980s, the #1 programming
language to teach children how to program was LOGO, which is basically Lisp in
disguise...

~~~
throwaway7645
If something doesn't have algol syntax, it generally doesn't do well with the
masses. Look at where Common Lisp & Clojure sit on the TIOBE list(do they even
break the top 20?) FP is picking up some steam, but I fear lisp never will
especially with such fragmentation of language and vendor. I'm not really
familiar with Logo, but it doesn't sound like it had parenthesis or brackets
like Rebol (something to make it homoiconic), and since it is not in use
anymore...that might be proving my point.

~~~
kazinator
I posit, without proof, that Algol has Algol syntax.

Where is Algol on TIOBE?

~~~
throwaway7645
C, C#, C++, Java, & JS could be said to have a derivative of Algol syntax.
That covers probably 90% of all software being actively written in the world.

------
victornomad
I'm sure Kotlin is a good language but as a developer with a big codebase I
find it difficult to migrate my Java code to Kotlin or mix both languages in
the same project. I think I will be confused all the time!

If I would be starting with the platform now I'd start with it but now I dont
see any reason!

~~~
Zak
It looks to me like Kotlin is enough like enhanced Java that it's pretty
painless to extend an existing Java codebase with it. IntelliJ even has
automatic translation of Java source files to Kotlin, though I'm sure there
are edge cases where that doesn't go well. The benefit is not having to write
Java anymore. If you don't mind writing Java then I think you might benefit
from exposure to a wider variety of languages.

As for getting confused between languages, most of us work in heterogeneous
environments these days, even if it's just something like using Python server-
side and Javascript client-side. I don't find confusion over the languages to
be a significant difficulty there and I don't think it would be with a mixed
Java/Kotlin project.

------
geodel
Now more I think about It is genius move by Google. With this low effort work
Google generated lot of buzz. Android remain same. Tooling and language is
developed by Jetbrains for Kotlin. If Kotlin brings in new developer to
Android, great for Google, if not, dependable Java is always there.

------
edzo
dude, wheres my dart/go android support?

~~~
base698
When they have a repl maybe they can be considered.

~~~
korm
pub global activate dart_repl

pub global run dart_repl

And I'm sure Go has a repl too.

------
dep_b
So how is Kotlin's interop with native code? I heard it was still pretty bad
with Java despite some updates in that department. Swift can handle some API's
but for real interop you can go back to Objective-C(++) wrappers with zero
penalty.

~~~
nostrademons
You mean Kotlin <-> Java or Kotlin <-> C?

Kotlin Native (Kotlin <-> C & Objective C) _just_ came out this month, is
still a technology preview, and AFAIK is really rough around the edges.
Haven't tried it.

Kotlin has always had a very good Java interop story, in both directions. I've
been using it for a year with Hadoop, AWS, JSoup, Rome, Jackson, DropWizard,
Jetty, Apache Commons, ElasticSearch, Weka, and many other standard Java
libraries and never had a problem. You basically drop in a library and go.
Several of those libraries are either really old (eg. Weka was written in the
last millenium) or pretty complex (Jackson is all annotation/reflection
based), and I've never really had a problem. You do need to keep track of
nulls yourself when crossing the Java boundary, and you need to understand
what code Kotlin generates if you're implementing an interface or placing
annotations, but both of those are well-documented and pretty typical tasks
for any FFI work.

~~~
swah
Did you choose to work with the JVM since leaving G?

~~~
nostrademons
Yeah, for this project at least. I've found that my choice of technology stack
is largely dictated by a.) the libraries that are available and b.) the
potential market I'm investigating. It's in Kotlin because I need Hadoop for
at least part of the project, and one corpus I'm working with has a bunch of
supporting tools in Java that aren't available on other platforms.

I'd been doing a bunch with smartwatches a year or two back, so the project
before this was in Swift (because when I talked to potential customers &
looked at market share numbers, starting with anything other than the Apple
Watch was indefensible), and two projects before then were in Java (because
the Apple Watch wasn't out yet and Android Wear & Pebble were the only games
in town). There were also a couple ideas that I'd tested out using just
WordPress and YouTube, with no coding at all.

------
vbezhenar
I wonder if Kotlin could compile to Dalvik bytecode in the future? It might be
pointless with Java, because Oracle owns Java compiler and maintaining
separate fork might prove hard to do. But with Kotlin it should be somewhat
easier. I've heard that the whole Android development is very slow because of
those intermediate steps.

Also it might help to develop or improve live update features. If I'm
developing server applications, I'm usually using JRebel which allows live
reloads of bytecode and that's tremendous productivity gain. Same with React
Native. I'm not sure about pure Android development.

~~~
ptx
Google already tried compiling Java source code directly to Dalvik bytecode
(the "Jack" compiler) but they recently abandoned that approach in favour of
improving the regular Java-bytecode-based toolchain. Perhaps because of the
new focus on Kotlin?

The Android toolchain used to be horrendously slow but has gotten a lot better
since they switched from Eclipse and Ant to IntelliJ and Gradle – assuming you
have enough RAM to dedicate a few GB to the persistent Gradle process. It now
has incremental compilation (of Kotlin and Java), incremental dexing (i.e.
converting the compiled Java bytecode to Dalvik bytecode) and incremental
reloading ("Instant Run"). And the emulator can run the x86 version of Android
nowadays, so it's no longer slowed down by emulating ARM. It's pretty nice.

------
yawaramin
How is Kotlin compile speed relative to Scala? I imagine a little faster,
anyone have experience on mid-size projects?

~~~
lokedhs
Seems to be about the same as Java. The main source of slowness when compiling
is, as always, Gradle and not the compilation itself. Kotlin doesn't fix that.

~~~
yawaramin
Java-level compile speed sounds amazing. My build system experience is with
sbt, which is mostly slow on startup because it checks the versions of every
library, every time. The rest of the slowness is from the Scala compiler. A
fast Kotlin compile plus a fast command-line build resolution would be a
killer combo.

------
xaduha
BTW for those who say that Scala interop with Java is as easy, can you
demonstrate how to use this from Java?

[https://github.com/tumblr/colossus](https://github.com/tumblr/colossus)

~~~
emodendroket
I think the claim there is more like "you can already use the huge amount
libraries/your existing code with Java and, with care, you can make your Scala
code work the other way" than "interop is seamless back and forth."

~~~
xaduha
Well Kotlin does indeed claim that interop is seamless back and forth AFAIK.

~~~
emodendroket
Which is neat, but unless you are a library designer it's probably not that
much of a selling point.

~~~
xaduha
Major selling point is the ability to mix Kotlin and Java freely.

I just find it funny how Scala guys are saying "me too" at every opportunity.
But that always comes with an asterisk, if you look closely.

IDE support is as good, Java interop is as good, etc.

~~~
emodendroket
Sorry, I didn't realize you were personally invested.

~~~
xaduha
Well I like and use Kotlin, that's the extent of it. Scala is a non-starter
for me.

~~~
emodendroket
How come? I started using it because my company did and I've found it pretty
good, overall.

~~~
xaduha
I started using Kotlin because the author of MapDB did

[https://github.com/jankotek/mapdb](https://github.com/jankotek/mapdb)

Scala was around for a long time, perhaps if I could look at it with fresh
eyes now I would consider it, but somehow I always had a feeling that Scala
isn't for me. And now as Kotlin gaining momentum I'd rather stick with Kotlin.

I want first class IDE support and straightforwardness in my workhorse
languages. For hobby languages I'd rather play with something like Red or Perl
6.

~~~
emodendroket
I haven't tried Kotlin but Scala works with IntelliJ pretty well. I'd say it's
pretty comparable to VS/R# with C#.

------
wheelerwj
alright, wtf is kotlin, why is it suddenly such a big deal, and how big of a
deal is it?

edit: so i checked this out myself. i have no idea why this is a big deal.
another app language? i thought reactnative was all the jazz?

~~~
a_imho
Judging by your downvotes I guess it is just Google PR out in full force the
last couple of days.

~~~
mikespikey
It's jetbrains' PR now added with Google.

Google employees can destroy any post on reddit. Jetbrains copied that model.
Anything about Jetbrains will have tons of artificial posts at the top, their
crew upvoting it.

It's useless this sort of thing is killing social media completely.

WTF is kotlin and why would anyone in their right minds use a language from a
text editor company. Beats me.

------
m3kw9
To summarize, is genius because it keeps devs happy. It's an apple move

~~~
sangnoir
Apple keeps users happy, not devs. Just take a look at Xcode.

------
throwaway47861
When I see quotes like "Oh my God this is awesome" my sensors go to red flag
mode full-time.

Devs are people like everybody else and can be hyped.

Let's give it time. Not sure what's the big fuss about. Yes I've read about
GUI toolkits that reduce the development time. This still doesn't mean much
IMO. The business owners will simply become more greedy and will demand more
work for less money.

I really don't see how the devs will win.

------
sidcool
My question, which I also posted as Ask HN, was that why not Scala?

~~~
romanovcode
Because Scala doesn't give a !@#$ about backwards-compatibility. It's too
unstable for huge project as Android.

------
wolco
Not sure if swooned is the right word.

------
zmix
Such a misleading title!

------
maxsavin
Genius is a strong word here

------
awaisraad
Android will eventually adopt Swift. It is not a matter of "if" but "when".
Who knows 5 year from now, you all will be coding in Swift (for servers, iOS
and Android).

~~~
PeterisP
Can you list arguments why do you believe this to be likely?

Interoperability of Swift with the existing APIs and JVM is not impossible,
but it is a significant barrier that needs to be overcome and needs very, very
significant advantages to justify that.

~~~
awaisraad
Watch: [https://news.realm.io/news/tryswift-chris-robert-end-to-
end-...](https://news.realm.io/news/tryswift-chris-robert-end-to-end-
application-development-swift-backend/)

~~~
swsieber
IMO, kotlin makes a much better candidate to be "the" cross platform language
for server / client since it supports typescript as a first class citizen, and
a native target is coming.

You could use the same arguments in the article you posted to posit that
everyone will be developing on a Mac.

It's not very convincing to me.

------
appleflaxen
> Standing on stage on Wednesday morning at Google I/O, > Android PM Director
> Stephanie Saad Cuthbertson broke the > news that Kotlin, which was first
> released in 2012, is now > officially supported as a “first class” language
> for > Android... > developers whooped freely when told that they no longer
> had > to worry that Kotlin fever was just a phase, to be > abandoned like
> dozens of other cult favorites before it.

Nothing that google says about Kotlin could _possibly_ mean that it's not a
phase, to be abandoned like other cult favorites before it. Is Kotlin more
official than Wave? Reader? Fiber? Loon? Boston Dynamics? Picasa? Titan?
Glass? Google+? Labs? Gears? Code Search? Health? Knol? Orkut? Answers?
Deskbar? Page Creator? Sites?

Google has the right to stop supporting whatever they want, but there is a
hard-to-measure cost in developer trust (and goodwill).

edit: formatting

~~~
bitmapbrother
You make it sound like Google is the only company to EOL underperforming
products and services. How many products and services has Apple or Microsoft
abandoned or shut down during their span? I'm guessing that list is very long.

~~~
_pmf_
They have the right to EOL what they want; but OP is still right to warn about
it based on Google's history of EOLing stuff that has been liked by the
community.

> How many products and services has Apple or Microsoft abandoned or shut down
> during their span?

Microsoft is the best example for commitment to API compatibility over
decades, i.e. the polar opposite of Google.

