The New Client Application Landscape

Back in the early 2000s, selecting a development platform for client software applications was easy. You wrote C++ code using the native OS APIs (Win32, Carbon, X11) or thin wrappers on top of them. It also became practical to write clients in higher-level languages like Python or Java, provided you were willing to put up with some rough edges in the implementations of GUI toolkits and cross-platform issues.

There’s nothing fundamentally wrong with these platforms, and despite all the hype about web applications taking over the world, I think it’s perfectly reasonable to develop new client software with them (provided you “pay your taxes” to keep up with modern OS requirements like packaging systems and user data persistence). In fact, good cross-platform toolkits like Qt and WxWidgets have made OS-native client development easier over time.

However, as I consider developing a new, graphically-intensive client program intended for a large user base, I feel obligated to look at browser-based platforms, specifically Flash and JavaScript.


The Flash Player has already become popular as a game client platform, notably for Zynga‘s Facebook games, and even some MMOs. It has no standards-compliance issues because there is only one canonical implementation. Its sound and graphics features are solid and well-optimized, although the 3D API is still pretty limited. There are some GUI controls libraries for Flash, but they are not as well-developed as those in a desktop OS or a good JavaScript framework.


From a desktop developer’s point of view, JavaScript is essentially a bare-bones scripting language interpreted by the browser, coupled with a small “standard library” including an API for manipulating the browser’s layout and display engine (the HTML DOM). JavaScript applications work by pretending to be a web page with various elements that appear, disappear, or move around according to the script. There are many “widget libraries” for JavaScript that emulate desktop GUI controls to some degree of success. Although JavaScript-based controls sometimes feel clunky, it’s important to remember that you get the full benefit of the web browser’s page-layout engine and its HTML controls (buttons, sliders, etc) for very little code. This could be a powerful advantage for writing GUIs that make heavy use of traditional desktop-style controls.

Future browsers will (hopefully) also include WebGL, a complete JavaScript interface to OpenGL which renders into an HTML canvas. In theory, you could port most sophisticated rendering code, like a modern 3D game engine, to this interface. Unfortunately, WebGL is just an emerging standard and there is a risk that browsers won’t ship it widely or support it well. It could join the long history of widely-promoted but seldom-implemented standards like VRML or the non-audiovisual parts of MPEG.

Limitations of the browser as a platform

Flash and JavaScript both have some important limitations:

  • You can’t communicate over arbitrary TCP sockets. In both platforms, client/server communication has to use XML-RPC features.
  • You have no control over the “event loop.” This is a potential source of problems with input polling and timing control. In particular, the WebGL code I’ve seen uses a wonky technique for frame timing: the script schedules an “update” function to run at periodic intervals (or with a zero timeout, which tells the browser to handle inputs and then return immediately to the script). This feels clunky compared to the high degree of control you get with a native client, which can explicitly select on file descriptors with precise timeouts and/or pause for graphics buffer swaps.
  • The programming language will be different from the server side, making it difficult to share libraries and move code back and forth. There are a couple of “language translators” that target JavaScript (Pyjamas for Python and GWT for Java) but this seems like a fragile approach.
  • Client-side storage options are limited. There are ways to store small stuff, but typically not hundreds of megabytes of 3D models and textures. I suppose you could do something crazy like install a small native web server on the client and access it via HTTP to localhost.

How to Decide

In the end, the decision of which platform to use will depend on a few factors:

  • How much does the application resemble typical desktop GUI software?
  • Are you continuously rendering a changing scene, or does the app sit and wait for input?
  • How much client-side storage is needed, and is client-side software installation going to be a problem?

Server Platforms

On the server side, not much has changed over the last few years. The first tool I’m going to reach for will still be Python, writing directly to the Linux POSIX APIs. Python has a rather nasty (though constant) performance penalty versus compiled code, but I can usually get around that by selectively translating critical sections into C.

(The only situation where this approach might fail would be a system that had to run arbitrary, hard to vectorize scripts very very fast – something like a game engine simulating a large number of independent AI agents. In this case you might need to look into a more JIT-oriented platform like Java. However, without going this far I think it’s possible one could get the performance penalty low enough to make it reasonable just to throw more hardware at the problem.)

Leave a Reply

Your email address will not be published. Required fields are marked *