Development Freedom in New Platforms

July 25th, 2013

I started writing code when I was somewhere around 1st grade, hacking some rudimentary BASIC on a TRS-80. Since then, I’ve used more programming languages than I can count; everything from C to Prolog, Python to Haskell, and probably a dozen others. I enjoy diversity in programming languages and tools.

I’ve had an interest in both web and mobile development for some time, but have done little with either. Reflecting on that lately, I realize that both platforms severely restrict my freedom to use the tools I choose. Even on an old x86 with 640K of RAM, I had choices; BASIC, Pascal, and C would work under DOS. (Plus assembler, but I had yet to learn that at the time.) On Android, my choices are Java or… Java. (OK, or something that compiles to Java, but those selections are still limited.) Plus it seems like I’d have to use Eclipse, which seems to have taken the kitchen sync crown from Emacs long ago, and not in a good way. On iOS, the choices are Objective C. And on the web, it’s JavaScript.

The problem with all this is that there’s little room for language innovation on those platforms. If predictions about the decline of development on the PC pan out, how will the next advance in programming languages gain traction if the hot spots for development are locked down to three main languages? Will we find ourselves only willing to consider languages that can compile to Java/Dalvik bytecode? And won’t that put limits on the possible space for innovation to occur within?

Yes, I know about things like Mono and the Android Scripting Environment, which offer some potential for hope, but I think it’s still safe to say that these platforms are pretty closed to development in “unofficial” languages. I don’t know of major apps in the Android market written in Python, for instance.

I know of efforts such as Ubuntu’s, but even they simply lock down development to a different toolkit. There is no choice there of GTK vs. Qt, or such things.

Sadly, I don’t think it has to be this way. My phone has way more power than my computer did just a few years ago, and that computer was capable of not just executing, but even compiling, code written in all sorts of different languages.

But I don’t know if there’s much we can do to change things. Even with native code on Android, plenty still has to go through Dalvik (at least that’s my understanding). If you wanted to write a Python app with a full graphical touch interface on Android, I don’t think this would be all that easy of a task.

Categories: Uncategorized

Leave a comment

Comments Feed11 Comments

  1. planetdebian

    John Goerzen: Development Freedom in New Platforms: I started writing code when I was somewhere around 1st gra… http://t.co/DyMJiUzyjO

    Reply

  2. S

    > On Android, my choices are Java or… Java.

    On Android, there is Native Development Kit. It’s not supposed to be used for the UI, but it can interface with non-Java languages and libraries. As to languages which compile to Java, there are some nice free languages. And plenty of PL innovation is happening in that area.

    > Plus it seems like I’d have to use Eclipse.

    Not true. I’m using Emacs, ant and command line tools from the SDK. Android development is very command line friendly (most tutorials address only IDE setup, but CL tools are well documented too).

    > And on the web, it’s JavaScript.

    And on mobile platforms too. Or anything that compiles to JavaScript :-)

    > I don’t know of major apps in the Android market written in Python, for instance.

    In my experience, Android devices are much less powerful and less forgiving. That’s why a relatively low-level Java works quite well. I tried to use Scala on Android, and switched to Java for faster compilation times. UI code is not much shorter when writing it in a “smarter” language. The app written in a non-Java language can easily get bigger (Clojure, the last time I checked) or slower (anything interpreted).

    > If you wanted to write a Python app with a full graphical touch interface on Android, I don’t think this would be all that easy of a task.

    I’ve never tried it, but please check Kivy. It seems to do exactly this.

    > Will we find ourselves only willing to consider languages that can compile to Java/Dalvik bytecode?

    What’s wrong with targeting JVM or some other VM wrt to only bare metal platforms? I suppose we’ll find ourselves using languages which target multiple platforms (x86, arm, jvm, js, beam, whatever). And backend programming is not going away any time soon.

    > If predictions about the decline of development on the PC pan out, how will the next advance in programming languages gain traction if the hot spots for development are locked down to three main languages?

    Interoperation and tooling. Cross-compiling and packaging is different, application life-cycle is very different, UI frameworks are different. All these things are not what defines a programming language, nor are they the areas of PL innovation. It’s just a matter of engineering and man-power. The development is not locked down to just one language (even if it’s the only officially supported), at least not on Android.

    If predictions about the decline of the PC come true, I’m more afraid of not being able to buy a laptop with a nice keyboard cheaply. It may become a niche and expensive (“professional”) product. And that’s going to hurt.

    Reply

    jgoerzen Reply:

    @S I know there are ways to compile native code (ASE and sshdroid wouldn’t be possible without it, of course), but one can’t write first-class apps that way, as long as the UI is Dalvik-only. Perhaps I am looking the wrong place, but last I looked the docs all talked about Eclipse.

    Not every VM is built alike. Some work well for some things; others don’t. I know there has been much talk about compiling Haskell to Java bytecode over the years, but it seems to have been a rather difficult task. I’m not sure that one could expect very performant code from compiling C to JavaScript, for instance. What if a person wants a different kind of GC? There are limits.

    Can I really write my UI in something other than Java (or the closely Java-related languages)?

    Reply

    tshirtman Reply:

    would python fit you? If so have a look at kivy (kivy.org) UI is not native (completly redone on top of opengl) but it’s nice and fast, and works on ios as well as android, and windows mac linux too… (so you can do dev on your desktop without using an android VM to test, which make it a lot faster. Also, it contains pyjnius on android, so you can access a good chunk of the android java api from your python app.

    Hope you like it :)

    Oh, and you don’t actually need to touch eclipse at all, i’m happy using only vim and command line :).

    Reply

    jgoerzen Reply:

    @tshirtman kivy definitely looks interesting. I will give it a look. Thanks for the pointer.

  3. Adam

    I think Joey Hess’ port of git annex (assistant) to Android is in Haskell? (It didn’t sound like a supported piece of cake, though: http://joeyh.name/blog/entry/Template_Haskell_on_impossible_architectures/ )

    Reply

  4. Pseudonym

    You can write on both iOS and Android in C or C++. You need a thin Objective C or Java layer (respectively). Of course, you can’t really do this for programs that need the native UI, but there’s no way around that.

    On the web, lots of languages compile to Javascript. I quite like GWT.

    Reply

  5. Jan Hudec

    Android is perfectly fine running native code. Application we write at work is written in C++ and runs on Android, Bada, iOS, WinNT, WinCE, Win8P and we are considering the new BlackBerry.

    On Android some Java glue is needed to access some system APIs and similarly ObjC glue on iOS, but libraries like Qt or SDL provide that if you wanted. Since Java is introspective I suppose you could do some binding that would allow calling the APIs from C by name without writing any Java per se. And of course once you have it in C, you can bind to anything else.

    Also iOS binaries are built with LLVM and Android recently started providing LLVM toolchain as well, so any language that can use LLVM backend should work (unfortunately there are not many of them yet).

    Reply

  6. mirabilos

    Indeed – on Android, you *can* write purely native applications, or run existing ones (as long as they work with the bionic libc) such as mksh, but the whole GUI goes through the Dalvik/Java™ stack.

    It’s possible to write full-screen applications that draw their own GUI. I do not know whether these can be done by pure Framebuffer access (after telling SurfaceFlinger and friends to hands-off), but I do know that applications that do that, like CacheBox, are perceived as absolutely unusable on *all* platforms they run on (in the CacheBox case, it draws the same GUI manually on both Android and Windows CE, but it looks native to neither and is totally unintuitive to use on both), so this is a *big* no-no.

    One thing you can do in e.g. Android is to chroot into other systems.

    Maybe qemu/kvm on ARM (to run e.g. Linux on top of iPhoneOS or WinCE or Windows Phone) might be worthwhile to look into – the CPU is the same, so a full qemu-system-* is not needed.

    In the end… I’ve got a mixed reaction. On one hand, sure, limitation is bad – on the other hand, it led to me exploring the system at first (while my first computer booted to DOS, I used GW-BASIC – and Assembly – quickly). Maybe you need both, not necessarily in the same “market”?

    Reply

    John Goerzen Reply:

    Has Android 4.3 locked down the GUI though?

    Reply

  7. Motiejus Jakštys

    Take a look at Sailfish OS. It limits your freedom much less, as it is sort of a standard Linux distribution. There are official apps in Javascript (QML5), C++ (for anything that can’t be done in Javascript). My friend put a Python program to official app store. I am writing a game in C++ and Lua.

    Among other programs, it has wayland, systemd, btrfs, gcc. I just installed git with package manager. Terminal and openssh (client+server) are among really helpful applications that are installed by default.

    Reply

Leave a comment

 

Feed

http://changelog.complete.org / Development Freedom in New Platforms