When I first read about Firefox OS, the ongoing project to make an operating system for phones and tablets that runs entirely in a Firefox browser, I thought: what a marvellously futile idea.
The world isn’t short on niche, provisional, or failed experiments in operating systems for phones: Sailfish, Tizen, webOS, BB10, Ubuntu-for-phones, Meego, (cough) Windows Phone 8… Firefox OS is aimed at low-end phones—just the sort where you’d expect the hardware efficiency and limited data requirements of offline native-code apps to offer a big advantage over the browser. So I was ambivalent about its advantages to the user.
The developer side is interesting, though.
C++, the Portable Choice
Look at the current mainstream phone platforms.
For iOS, the “native” development language and framework is Objective-C with Cocoa. For Android, it is Java. For Windows Phone 7 (I do mean 7, rather than 8) it was C# with Silverlight or XNA frameworks.
These three are totally mutually incompatible. You can’t reuse Objective-C/Cocoa code on Android, you can’t run Java on iOS, and the Windows Phone managed environment was incompatible with both.
But every platform has an embeddable web browser, so besides native apps, there have always been somewhat cross-platform HTML apps—often developed using tools like PhoneGap. These aren’t always popular with users, something widely acknowledged when Facebook rewrote their HTML-based iOS app as a native one.
The tension is that while native apps usually work better than totally cross-platform ones, it is desirable to be able to reuse at least some of an app’s business logic across platforms. So developers have increasingly been shifting business logic from the platforms’ primary languages to C++. Google made increasingly more of the Android frameworks accessible from C++ using the Android NDK; Microsoft switched to C++ as their recommended language when developing for Windows Phone 8. Objective-C apps can incorporate C++, so the same code can serve across all three platforms. (How interesting that C++ should have become the portable choice in preference to Java or C#.)
This situation isn’t wholly satisfactory, not least because C++ is a difficult language to learn to write reliable, comprehensible code in.
The Web Angle
Now there are still all sorts of holes and potential pitfalls here. But you’ve got to admit, it’s a pretty interesting proposition.
So I bought one of the Firefox OS developer devices to have a look at. In my next post I’ll make a few notes about the current state of the platform, and try to guess whether any non-developer would ever want to use it.