The Android operating system provides a powerful, open platform for mobile development. It leverages the power of the Java programming language and the Eclipse tools platform. Now you can add the Scala programming language to that mix. In this article, see how you can use Scala as the primary development language on Android.
It takes a little time to get used to, but it is the most powerful language out there at the moment.(At least for the JVM)
You can strike the “at least for the JVM”. There are some academic languages that might be considered more powerful (haskell, clean, oz). And of course if you are looking for raw performance there is always C++.
But at least on the CLR there is nothing available that is as powerful yet clean as scala. C# contains too many nonorthogonal language features, and F# feels like two languages grafted into one (a bit like C++/CLR).
For the CLR there is always Nemerle. Like Scala it tries to merge Java/C# like OOP with functional language features such as type inference and pattern matching. It also has a clever macro mechanism for syntax extension.
i don’t see Scala giving much advantage over Java, plus it is not well supported as Java generally. Language itself seems complicated like C# fitting only power users. it would be only “exotic” to use it for Android development IMO.
Glad you read the article! Scala has a lot of powerful features. However, it is very much an a la carte language. You don’t have to use those features. You can write very Java-ish code in Scala, only you will write a lot less of it thanks to type inference, case classes, etc. After awhile you may venture out to using things like closures, multiple inheritance, operator overloading, and pattern matching.
Back to the article… I must disagree with the “exotic” assessment with regards to Scala on Android. Not only do you get all of the basic benefits of Scala over Java, but there are certain aspects of UI development that really benefit from Scala. I gave a couple of examples of this in the article: using a closure to handle a button click event and using pattern matching to handle menu selection events. There are many other things like this. I started an open source project with the purpose of sugaring the Android APIs using Scala: http://code.google.com/p/scala-android/ .
@michaelg,
I think Scala on Android is a wonderful idea. I am an iPhone developer but a newbie to both Java and Android. Though I like developing for iPhone, we don’t have choice other than Objective-C. Being able to choose is always a good thing.
Yours is a great article, I just wish there is more info on how to build the Convertor example with Eclipse/ADT/Scala plugins for a newbie like me, . I am trying to follow the direction on
http://www.scala-lang.org/node/160 , but it might be dated, my eclipse IDE keeps crashing.
Are you serious? Compared to scala, C# is an ugly grab bag of features thrown together without really thinking about the big picture.
And scala not being more powerful than java is just ridiculous, except in a very literal sense (both are turing complete).