The Web as an Application Distribution Platform and the Open Cloud

Having managed to produce five blog posts last week, I’ve taken a few days break from blogging A) because I’ve been busy with other stuff and B) because I ran out of stuff to talk about! However, now I’ve thought of something to write about…

Wow, that title is a little overwhelming. Basically this post is about what I’m going to term the Open Cloud, the problems with it and how treating The Web differently might help. I suppose I should start by defining exactly what I mean by the Open Cloud…

The Open Cloud (A.K.A Free as in AGPL)

Like it or not, cloud computing is here to stay despite what Richard Stallman might have to say and for most of us it’s  going to be great. Now, I respect RMS as much as your next Free Software supporter, but I fear he’s way off the mark here. I share his concerns over companies that don’t really care about your data or your privacy. However, Cloud Computing itself isn’t inherently bad – how can it be, its just a technology and technology is only as moral or immoral as those who wield it. So, what do privacy respecting, Freedom loving, FOSS advocates do. We do what we do best – start coding! We start building an Open Cloud.

“But Surely we already have an Open Cloud?”

Yes we do, but shouldn’t confuse this Open Cloud with the Open Web. The modern web, for the most part is built on standards which are completely open, from TCP/IP right up to CSS, HTML, RSS and other glorious acronyms. However, most of the applications that live in the cloud most certainly aren’t Free or Open. They are as closed as your average binary blob, more in fact because you don’t even have access to the running binary code (oh, and APIs don’t count guys). When I say Open Cloud, I’m referring to FOSS applications running in the cloud, preferably under AGPL (other licences are available), which is specifically designed for this.

“Hang on, aren’t there loads of FOSS web-apps out there?”

Well, yes there are, this blog is running on one of them, WordPress. Then there’s Drupal, Joomla, Roundcube, Davical, etc. The problem with most all of these is that they miss out one of the prime benefits of Cloud Computing in that they all need hosting by individual users (OK, so WordPress was a bad example as there is a hosted option). What I’m really talking about is hosted applications, that people can just use, but can also be installed on your own server. These can be really small things and would preferably start with replacements for popular closed web services.

“Hang on, don’t we have a few of those already?”

Right again, but the emphasis should be on A FEW. We don’t have nearly enough of them. So far we have identi.ca/StatusNet, Libre.fm and Libravatar and that’s pretty much it (please let me know of any more), although I guess Diaspora is coming. Ideally, we would have a replacement for every proprietary web app and more, but we just don’t seem to be getting there.

So what’s going wrong…

Basically, web apps are different to desktop apps. Apart from using different technologies, they require hosting to actually run them. If you want to run your shiny new FOSS web app that you’ve just come up with as a hosted service, you yourself have to find this hosting. For small FOSS developers who might otherwise build these services this could initially put them off. However, it you’re just starting out then your hosting costs wouldn’t be huge, but as your service grows this is likely to be an increasing problem. I don’t think it’s any surprise that identi.ca (which is probably the most successful free web service) is backed by a commercial company.

So what do we do about it…

HTML5 (or just HTML as it should now be known) gives the FOSS community an amazing opportunity. The technologies available in the HTML5 specification should allow us to build web apps that are lighter on the server. Specifically, I’m talking about the offline web app functionality and local storage. This basically gives us the ability to build cool web apps that are really light on server side processing and storage. Much as I think JavaScript has its problems, it really has come of age with HTML5. HTML5 gives us the opportunity to build FOSS applications that are not only available to people running FOSS platforms, but available to anyone with a web browser (a whole new demographic of users) and hopefully without killing all our servers.

One of the projects driving this (in the FOSS world) is UNHOSTED. Primarily this is a JavaScript framework in which applications would be composed of static HTML, CSS and JavaScript (i.e. no server side scripts). The system proposes other nodes which are solely for storage, thus providing a separation between the storage of data and its processing by applications. The data would even be client side encrypted (think Firefox Sync or SpiderOak), but only with JavaScript so I’m not sure how secure this is. That’s all cool, but currently it lacks one of the major advantages of cloud computing, which is the ability to do processing on both the client and the sever. Perhaps it will evolve into something which will allow this processing in a distributed, decentralised, privacy respecting way.

I certainly think there are use cases for wholly client side JavaScript apps and that the FOSS community could tackle building some of them, whilst we are searching for solutions to the wider scalability problems of server side code and storage. However, there’s no use writing apps that everyone can use, if nobody knows about them.

An Application Distribution Platform?

The web already is an application distribution platform. It has been for ages, but up until now those applications haven’t been very discoverable. This is starting to change. I guess most people have heard about Google’s Chrome Webstore. This is their attempt to bring the App Store/Package Manager model to the web, basically its just a catalogue of web apps and some scripts that create short-cuts to them. Whether you think this equivalent to installing an application or not (I actually don’t think it matters) the idea is great, at last there will be a place to go to find web apps that you want to use. Mozilla are also jumping in with their Open Web Apps project. This is more of a specification for doing this across multiple sites and is the tech that I’m backing (personally I’d like to see web app stores that automatically discover new apps and add them to their catalogues). If one of these app stores makes its way into a future version of Firefox then that would be the perfect platform to push FOSS web apps to the masses.

Conclusion…

I don’t know whether the ability to make almost entirely serverless web apps will help the state of the Open Cloud. I really hope it does, but JavaScript still has a lot of limitations that native app developers don’t have to put up with. That said, there are a lot of advantages, such as users never having to update an app (they always have the latest version). I also don’t see web apps overtaking native apps any time soon. More likely we’ll see a continued fusion between the two, especially on mobile platforms, so that eventually the boundary between them is indistinguishable. I hope that the app store model will increase the visibility of FOSS web apps and encourage developers to get coding, but we’re only at the very start of the story on this, so only time will tell.

On Language/Platform Restrictions…

Editorial Note: I know I said I was going to have a Kiwi Pycon Roundup, but I’ve been really busy recently. I’m now going to wait until the conference video/audio is posted then I can give a proper roundup and post people to the talks I found particularly interesting.

OK, today I’m having a rant. This isn’t going to be an ill conceived rant about a company, like my last one. This one is about something of a general feeling that I’ve been getting recently. I want to talk about what I call Language/Platform restriction (I’m open to a better name). This can best be described by taking an example, the best of which is Android.

So, you want to develop an Android application, but you’ve got no experience in this area. So what do you do? You head over to the Android Developer site and read some of the tutorials and documentation. To your dismay you find all the code is in Java, but you’re a Python programmer. There doesn’t seem to be any way to use your favourite language on Android, despite everyone claiming that Android is an open platform.

Granted, this example is a little contrived. The chances of any developer not knowing that Android is a Java only platform are pretty small. This isn’t even my own experience as I’m pretty good with both Java and Python (though Python is my favourite). I guess my point is that developers have preferences over which language they like to use and that these preferences seem to be being largely ignored.

Now, Android does have a working Python implementation as part of the SL4A project, but this is very much a scripting environment not an application development environment. There is no native access to the Android APIs that are required to develop a fully fledged application. Also, in my opinion its usefulness as a scripting environment is limited by the lack of a Free Software cron equivalent, to run scripts automatically.

Lest you think I’m picking on Android, this problem isn’t specific to that platform. It’s also present on The Web. “Oh No!”, I hear you cry, “The Web is an incredibly open platform, you can use any language you want!”. In some ways this is true, on the server side, yes you can pretty much use any language you want (I’ve never seen any web apps written in assembly, but I’m sure it’s possible). The client side is another matter though.

If we restrict ourselves the technologies which make up “The Open Web” (basically ignoring Flash and Silverlight), we really only have one option: Javascript. Now, Javascript has historically been a complete mess. Granted it’s getting a lot better with HTML5, but it still kinda sucks. It doesn’t have any proper OO (please don’t offer up that “a function is an object” crap, as a sorry excuse). It’s still pretty low level, certainly compared to Python and it seems to be “the language which syntax forgot”.

This worries me. It actually worries me more than the Android situation. The reason for this is that I think The Web is going to be the main application delivery platform going forward and that Free Software needs to seize on this to create a suite of Free cloud applications, just as we have for the desktop. However, the lack of a choice of languages puts me (for one) off.

There have been efforts to port Python to the browser, specifically Pyjamas and Skulpt. There are problems with both these implementations. Pyjamas is too tied to its own application framework (which come from Google Web Toolkit) and it basically ends up bringing desktop like application programming to The Web. Maybe this isn’t a bad thing, but it seems to miss the full potential of The Web. Really what we need is something that takes advantage of all The Web’s APIs, but without having to use Javscript. Skulpt, although initially promising, does the compilation from Python to Javascript on the client side, thus multiplying the overhead in doing so by the number of clients (granted its distributed, but it still seems wasteful when this only needs doing once).

I should also take a minute to mention Google’s Native Client plugin. Although its not really part of the standard Open Web technology suite, it is trying to expand beyond what Flash and Silverlight offer. Basically it’s a way to run native x86 code inside a web application and expose methods through a Javascript API. You can potentially run anything in there. There are some continuing efforts to port Python to this platform, but I think this is the wrong way to go too. It’s not really intended to be a full runtime, its more like a sandboxed version of ctypes for Javascript.

In both these situations (Android and The Web) the best option is for native support for other languages to be added directly to the underlying virtual machine. However, this doesn’t look like it’s going to happen any time soon, so we might need some other solutions. Pyjamas and Skulpt have demonstrated that it’s certainly possible to compile Python to Javascript so I think that’s a low hanging target. I haven’t seen anything more promising than SL4A for Android yet, and porting dynamic languages to run on Dalvik strikes me as much harder (given the static nature of Java).

Throughout this post I’ve kind of focussed on getting Python to run on other platforms, but what I’ve said pretty much goes for Perl, PHP or any other language. If anyone has any thoughts on this topic, or details of other projects I should check out, please get in touch. My main fear is that we’re going to end up with a situation where there is not choice of programming languages for any given platform and that some of the best languages will be left out in the cold.