

Ask HN: Which programming languages for mobile apps? - globalrev

Which programming languages should I learn if I want to do mobile apps?<p>Which can you use for each platform?<p><pre><code>  * iPhone: Objective C(only?)
  * Symbian-phones(Ericsson, Nokia etc): Java and C, Python on some Nokia? Correct?
  * Android: Java? Or any language since it is open source? Or it only has to compile to the Dalvik VM? According to:</code></pre>
http://www.scala-lang.org/downloads/targets/android.html Scala can be used. What about Clojure?<p>Other platforms?
======
meredydd
_Android: Java? Or any language?_

The bad news is that the vast majority of the "other" languages for the JVM -
and this includes Clojure, JRuby, Jython, and rest - are dynamic. This means
that they are either interpreted or compile to Java bytecode at run-time. Pure
interpreters are fearsome slow, so these days everybody does runtime
compilation.

Runtime compilation, however, won't work with Android. For licensing reasons,
they use their own funky Dalvik VM, with a different instruction set to the
JVM. Although you write Android code in Java, all the code in your .class
files is translated into Dalvik bytecode as part of the packaging process.
This is naturally incompatible with generating JVM bytecode at runtime.

The upshot, then, is that none of the big dynamic languages will run on
Android, which is a big pain. Scala is an exception among the "other JVM
languages". Because it is very static and doesn't have "eval" functionality,
it can be completely compiled (and translated) ahead of time.

Unfortunately, even Scala has problems with Android development: For starters,
the runtime libraries are over 3MB (compressed!), which is going to tax if not
completely blow the memory of any phone. All that extra code between you and
the VM is also going to take its toll in CPU and extra garbage collection -
and on an embedded device, that's battery life you can't afford to spend.

For my money, then, the only sensible choice for Android development is native
Java. This sucks, relatively speaking, but think about it as a progression:
For most embedded development, C is still more or less the only sensible
choice. Java is still velvet cushions and hand-holding by comparison.

------
phd2000
It all depends. If you want to get your programs on carrier decks you are
either going to have to learn J2ME (Java) or Brew. Java powered phones are by
far the most popular, including all Nokias, S-E, and RIM Blackberry models.

However, I think the iPhone platform is the future. You have a distribution
model that bypasses the carrier decks with iTunes. Which is huge because it's
a pain in the ass to get on carrier decks, seeing how most NA phones are
locked from installing software unless you download it directly from the
carrier's portal. Then you have the fact that Apple users tend to open their
wallets more for software.

------
scorpioxy
I can answer the Symbian part since i've been there before.

You can use JavaME on it with some specific extensions, you can also use
Python(at least on S60), and you can use C++(not C, if i remember correctly).

But note that the languages on this platform do not all have equal
capabilities with respect to access to the underlying platform. There are some
things that are just not possible...Except for the C++ part, which is the
native language and thus has almost complete access to the system.

~~~
zacharye
Right, native S60 apps are C++. You can use use java as well but there are
tons of limitations.

~~~
mpfefferle
C++ with just a couple added limitations. Exceptions and static data are only
now (in v9) starting to be supported. Assume that you'll use Symbian's app
frameworks exclusively and not Boost, STL, etc.

------
babul
I would say find a problem you want to solve and build for that rather than
worrying about mobile languages.

If you alreay have an iPhone, go with that, if you use a HTC/Nokia smartphone,
build for that.

After you have built a few initial apps, you'll find things become much
clearer and be better able to find the answers you seek.

