
Why I Don’t Regret Moving Our Android App to Scala - walkingolof
https://www.lucidchart.com/techblog/2017/07/05/why-i-dont-regret-moving-our-android-app-to-scala/
======
chris_overseas
I don't see any real justification here for why it was worth the effort to
port the code from Kotlin/Java to Scala other than reusing their "well-
established skills with Scala" and "using sbt for our Android app has also
allowed us to leverage our unified build system". They're both valid reasons,
but they're not so much technical decisions as pragmatic ones for that
particular company.

The post states "hopefully I will be able to illustrate how Scala can
dramatically improve your experience while developing Android applications".
This claim isn't addressed in the post at all however. For example, it states
"Scala has a pretty decent concurrency primitive in Future" and explains how
to use them, but doesn't say what they offer over and above Java futures or
Kotlin coroutines. Most of the post is talking about how they migrated their
codebase and any compatibility or technical hurdles that were overcame on the
way (e.g. the sbt/Gradle mismatch), not about why Scala was a better choice
technically or what benefits it offers over Java or Kotlin. There's no mention
either of other practical issues such as the large standard library, method
counts, compile times and so on.

The addition of a few strong comparisons would be welcomed. As it stands, the
post feels more like "please don't fire me" than "where's my promotion?".

~~~
Lazare
I got the same vibe. Sort of a "hey, it actually wasn't _that_ big of a
mistake".

I didn't get the feeling they'd do it a second time if they had a chance to do
it over, knowing that Kotlin was about to get official support. (Or then
again, maybe they just really love writing Android code in experimental,
unsupported languages! And if so, who am I to judge?)

~~~
gregghz
Well we also used Swift way before a "stable" release came out. So maybe we're
masochists.

------
chickenbane
One thing I've noticed with Scala is Scala devs love rewriting everything in
Scala. Now, on one hand I totally get it, rewrites are fun and when you're
coming from Java and get used to Scala you never want to write any more Java.
(Especially at the time when Scala was really exciting and Java people were in
Java 6-7 period.)

The Scala ecosystem reflects this. There's integration with Java classes, but
calling Scala code from Java is less good. There's no binary compatibility
between major Scala releases. Scala has its own "simple" build tool.

I'm impressed the article's author was able to build their Android app in
Scala. However, I would not recommend using Scala on Android. No doubt Android
is popular in part because of Java, but the entire ecosystem is so much more
than the programming language.

The sbt-android plugin mentioned may work, but will never have the feature set
of Gradle integration. (Building Android applications is much more complicated
than a regular JVM app.) . In addition, sbt-android doesn't allow you to use
Android Studio, which is also a huge handicap.

Compatibility is likely an issue (Scala 2.12 requires Java 8, and support for
Java 8 bytecode has only been introduced in O). Compile times, memory usage,
method counts, etc. are all hard problems Android developers must be aware of
that are blissfully ignored by the Scala team.

By the way, all of this is why Android developers love Kotlin. As it was
designed for complete interoperability with Java, Android devs can migrate
piecemeal. You can use the same libraries, the same build system, the same
IDE. The reason why the biggest announcement at Google IO was Kotlin support
was because Android devs were already using the language and seeing its
benefits.

~~~
eeperson
> As it was designed for complete interoperability with Java, Android devs can
> migrate piecemeal. You can use the same libraries, the same build system,
> the same IDE.

This is all true for Scala as well.

~~~
pjmlp
Not really, it appears to require InteliJ and cannot work with the modified
version that is actually Android Studio.

It also doesn't integrate with the language aware tooling from Android Studio
or the Gradle versions being used on Android Studio.

At least this was the situation last year.

~~~
eeperson
Really? I haven't tried setting that up but here is an example from 3 years
ago of some one successfully setting up this exact combination [1]. Have
things gotten worse sense then?

[1] [https://groups.google.com/forum/#!topic/scala-on-
android/0y1...](https://groups.google.com/forum/#!topic/scala-on-
android/0y1VQ8t4Ojg)

------
weego
This just smells like poor underlying technical leadership more than a success
story.

Considering kotlin has really only recently become a 'mature' choice (if it
even is) to have a app written in it seems unnecessary but to then rewrite a
production app like for like because that language wasn't even a core
competency of your business in the first place is just reckless.

Technical debt is a luxury small business cannot afford because of the
opportunity cost of seeing it as technical debt.

~~~
nine_k
Technical debt is usually taken in exchange for speed of development. It's
exactly what a startup does.

A mature company can pay out all its technical debt, iron out the kinks in the
tech stack and polish well-working solutions. Until the business requires
another prompt and unexpected change, of course.

~~~
lgas
> A mature company can pay out all its technical debt, iron out the kinks in
> the tech stack and polish well-working solutions.

Sorry, Hacker News is a place for serious discussion, not absurd jokes.

~~~
nine_k
I've seen certain core systems being polished for years, removing the bulk of
the _local_ technical debt.

Having zero technical debt _company-wide_ is unattainable and impractical,
though.

------
thesmallestcat
Come on, this is neat. Try to appreciate it for what it is, a company
investing in Scala on Android. Who cares if Scala is not the idea Android
platform. There was a guy who was live-coding on iOS in Scheme a long time ago
and I don't remember everybody shitting on him. People are using Clojure for
Android even though it's not necessarily a great idea. If my only choices were
Java or Kotlin I'd probably shoot myself, but I'm not an Android dev.

~~~
BoorishBears
If that guy released the work as a production app then wrote an article trying
to sell us on the process, people might react a little more strongly.

There's nothing wrong with doing interesting things, but you need to be clear
to yourself and others that it's being done because it's interesting, or for a
specific reason other than "it's a generally good idea"

~~~
thesmallestcat
They state the reasons in the article. You may disagree with them but they
seem reasonable to me.

~~~
BoorishBears
No one is saying they're unreasonable, some people are disagreeing with them.
But you're strongly implying disgreeing is "shitting on them".

~~~
thesmallestcat
The claim is modest: I don't regret the decision. Disagreement in this thread
is mostly piling on, one commenter says 'the post feels more like "please
don't fire me"'. The disagreement is that "the author _should_ regret it"
which is pretty distasteful.

------
hoodoof
Interesting that people feel the need to write posts justifying why they
didn't implement in Kotlin.

Says a great deal about Kotlin.

~~~
eropple
I went the other way, Scala to Kotlin[1], and that's kind of the way I look at
it. Scala's a really, really neat experimental language with some awesome
ideas, but the amount of _work_ it so frequently entails is disheartening to
deal with and the developer experience with Kotlin is so, so much better in
both tooling and expectations.

If your stuff is awesome, you don't really have to justify it like this.

[1] - though these days I mostly just write Node with ES6 or TypeScript,
because consistency of ecosystem between browser, mobile with React Native,
and the backend is just way easier.

~~~
dkarl
My experience with Scala on Android was similar. As a language, it's very
pleasant and powerful and would be ideal for Android programming if only you
weren't constantly fighting against the fact that Android's tooling and
technology were built around Java. It's a time suck. React Native is vastly
easier, even though it means using Javascript.

~~~
gregghz
FWIW, google adopting a second JVM languages means that Android tools will
trend toward operating on bytecode and not source where applicable. They
released some annotation processors for Room and their lifecycle stuff that
operate entirely on bytecode so work well enough with Scala.

~~~
dkarl
That aspect was already true when I was using Scala. Scala code compiles into
.class files, and the Android toolchain takes over from there. Theoretically,
no issue at all.

------
acjohnson55
I'm a heavy Scala user who is somewhat skeptical of Kotlin, so you might say
this article is preaching to the choir.

And yet...while I'm convinced that it's quite possible to write Android in
Scala, but I don't understand _why_ the author's team chose Scala over Kotlin
for their Android app. I presume that there are benefits to being able to do
front-end and back-end work in the same language, but is this of interest to
devs that don't already have a lot invested in the Scala ecosystem?

------
hackcasual
As a fan of both Kotlin and Scala, I'd be interested in hearing if there was
more to the decision to migrate away from Kotlin than their existing Scala
code base.

~~~
bearforcenine
I wasn't directly involved in this decision and I've never worked on our
mobile apps, but I do work at Lucid. Almost the entire engineering team can
write Scala. About 3 people can write Kotlin. That was a big part of it. The
lead engineer on our Android app is also a Scala wizard.

------
emodendroket
I like Scala, but the fact that Kotlin is officially supported makes it seem
pretty compelling for an Android app.

------
jordiburgos
[https://www.youtube.com/watch?v=Uyb67x1C2Dg](https://www.youtube.com/watch?v=Uyb67x1C2Dg)

------
zwarag
Looking forward to: Why I moved back form scala and you schould too.

