Says a great deal about Kotlin.
Says a great deal about Kotlin.
This post is essentially someone arguing how their choice with no benefit to anyone but the developers of the app and with drawbacks for all other stakeholders (since finding quality Android devs with quality Scala skills will be hard and product quality suffers for the reasons I mentioned above) made sense because they already wrote microservices in Scala, ignoring the fact that Android has a very specific set of challenges and development methods that make it's similarity to "normal Java" superficial at best, let alone Scala.
To top it off, the article is touting several things that even normal Java Android development can do:
TypedResource and TypedViewHolder = Databinding, But I prefer Butterknife anyways
Replacing AsyncTask = Really dozens of ways, there are Futures in Java, I'd go with RxJava (and Retrolambda) personally.
case classes = AutoValue (but I'll admit case classes are more concise)
It's also ignoring things like how much of the syntactical sugar shown increases method counts.
besides compile times (mitigated almost entirely by incremental compilation) none of these things hold up. Method counts are irrelevant with proguard and multi-dex (FWIW, most of our count comes from google support libraries anyway). Our binary is around ~5mb. I haven't ran benchmarks but I promise you that http requests, writing to disk, and WebView performance aren't slower because of Scala.
And I'm not saying that skeptically, I really believe it. Which is all the more reason that I don't see why you'd go with the using Scala. I don't know if you're referring to Lucidchart but I just look at that app and I can definitely see how it might not have to worry about jumping through hoops to shave startup time from a high method count or loading large data sets with tons of serialization and performant animations where built in immutable collections have unacceptable GC implications.
On the other hand you can apply that same reasoning and say it doesn't matter that Scala was used. But then you wonder why the "case study" should be considered by others, who probably don't have the luxury of having a small minimally animated app that can ignore stuff like method count effects on startup speed. To me the things that separate a top 50% app from a top 1% are things like high method counts affecting startup time on slower devices. It's not like Kotlin doesn't have issues that mirror those in Scala, but because it's essentially a "thin wrapper Java" with a slim standard library it's easy enough to identify when you're going to run up against parts with those performance implications
So? Benefiting developers is very important.Development cost is the highest cost of software. Even if the only benefit of using scala is higher developer morale and productivity, it could very well be worth it.
> finding quality Android devs with quality Scala skills will be hard
We already use scala heavily at Lucid. We have to train Android developers in scala anyways. For us, using scala means the android developers only have to use one language, instead of two. It also makes it easier to leverage some common code in both the backend and the android app (for example serializing/deserializing objects over the network).
Using scala to write an android app isn't the right choice for everyone, and I don't think the OP is suggesting it is. But it was the right choice for us. And if you are already using scala in production, it is certainly something to consider when writing your android app.
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.
I use F# and found Scala to be a breath of fresh air after getting sick of Enterprise-y Java, but haven't had the time to venture into Kotlin.
Kotlin is literally Java plus sugar. That's all it is. It encourages doing the right thing through stuff you could totally do in Java but nobody does because it's awful to write in Java. And, TBH, for the 90% case that's pretty great. There's no Shapeless in Kotlin--but that's a good thing, because Shapeless encourages developers with skill but no taste to do awful things and inflict them on, say, me. ;)
So, no, Kotlin's not experimental. Because experimental is a mindset, not an alpha/beta release stage.
I've worked in Scala for the last 3 years and I've found implicits to be the biggest issue. They're hard to debug, it's not easy to tell which implicits are in scope. Things like that.
Being clever is a problem with the developer and not the language. Scala code is dense, sure, but that's not inherently a bad thing.
With everything else built on top of it with safer languages.
This is quite clear with the set of APIs that are being made available to C++ on those OSes.
Probably my biggest disappointment with Scala is really the type system. It's incredibly powerful, but it's unwieldy to use, and it's still full of footguns. "object" is great and useful until someone accidentally turns it into a giant race condition (true story). Traits can easily turn into a maintenance nightmare (ever seen an 8-way multiple inheritance scheme that fans out into 23 separate ancestor classes? I have!) Exceptions end up in a strange territory. There's ways to handle all of this (much of it involves "don't do that!"), but the point is that for all the type system's powers, it's not actually buying you that much except in comparison to Java 6/7. If I want powerful type magic, I can use Rust or Haskell or similar and get stronger guarantees from my compiler. If you're writing "better Java", which is traditionally one of the more common Scala uses, it's harder to justify over Java 8 or Kotlin these days.
All of which is to say, Scala is a really cool language, but I wouldn't write new projects in it if I didn't have to.
Bonus round: We had a Scala iOS app via RoboVM before RoboVM support was yanked. It still gives me nightmares.
I wrote an Android Scala app once. I regret the experience.
Any downsides, weak areas, problems?
The downsides are mostly what you'd expect. You're welding together a JS bundle with Java (Android) and Obj-C (iOS) generated projects to create a deployable and that's a little fragile, though it's not really a problem. `react-native link` exists to try to help with that by automating the insertion of dependencies that require going outside of JS (stuff like Firebase or other native-API integrations); on one hand, I've never gotten it to work, but on the other, I know both Android and iOS development separate from React Native so it's totally not something I even think about. That probably also encapsulates most bugs I might run into with packaging, etc. to the degree that it's really hard for me to answer your question. I already know both of those environments and most of how they get wacky; stacking a little on top of that's not really a big deal.
The hardest single thing to do was integrating Firebase because I got some wacky Gradle error, but I figured it out. The second-hardest thing was parsing every JS package (460 packages, yeeesh) in my app so I could make sure I included their licenses in the deployable to be compliant with the licenses (and I am certain some of the licenses I included are actually from the build tools, but whatever). There are 500kB of licenses in my app, hidden in an 'about' dialog box that I expect nobody will ever open, but if that's as hard as it gets...meh.
Debugging is worse than it could be, but it's React/Redux in a very constrained environment, I'm not worried by it. And there are often no platform-agnostic wrappers for stuff (I needed in-app billing as my app is time-limited demoware, and I have two separate codepaths), but let's be real--that's not much of a thing.
I like it. React and Redux are comfortable ways to handle state management and I don't spend much time thinking about it. It means not writing Java or dealing with Android directly and iOS development is certainly no worse, and probably a good bit better, than it was before. It's faster to make something that looks and feels good. Also, and it's a little thing, but the react-native project creation tools are awesome and they make getting off the ground really easy.