First off, let me apologize for the relatively long hiatus from my blog. Turns out I have somewhat of an excuse though: Last August (2011) I sold my company (Advanced Telemetry) to Siemens and have been undergoing a process that I like to refer to (only half-jokingly) as “assimilation” since then. This hasn’t left a lot of time for blog-writing but now that the brain implants are healed over (kidding), I am back to what I hope will be a pattern of regular entries here. Good news for the 3 of you that follow it.
The topic of this blog entry is the exciting new technology trend known as the “Single Page Application”, or SPA. Before I get into what this means and why anyone should care about it, let me take a step back and reflect on what the overall Cloud trend means for applications and how we interact with them.
As previously discussed in this blog, the Cloud Computing revolution reaches the everyday user in a straightforward and easy-to-understand way. Cloud Computing enables a software development and deployment paradigm where data and computational resources reside in the “Cloud”, with devices such as mobile phones, PC’s, tablets and televisions simply playing the role of user interfaces. In this world, a lost or damage interface device does nothing to the applications and the data that they depend on. Furthermore, your applications and data can be seamlessly interacted with across multiple devices in a manner most suitable to the form factor of the device itself.
This trend is already very much underway. Think of Gmail, Microsoft Office Live or any of the other web-based applications that you may use every day. Up to now this move away from traditional desktop applications has been somewhat hampered by the relative compromises imposed by browser-based user interfaces. Troublesome realties such as page refreshes, slow internet connections and general unresponsiveness are a common feature of most web apps today. This is changing though, and at the tip of the spear is the SPA development paradigm.
The SPA approach is relatively simple – at least conceptually. In this design all of the HTML, style sheets and graphical images for the entire web application are retrieved by the browser as soon as the web site is first accessed. From there various pages and views are presented to the user without having to load any significant portion of the web content from the server – unused pages are simply “hidden” from the user while not needed but are still loaded into the browser and are therefore ready to be presented with no perceptible delay. At this point the remaining exchanges between the browser and server are limited to small, discrete messages that contain data or instructions for modifying data. These exchanges are commonly performed using technologies such as AJAX (Asynchronous JavaScript and XML) and JSON (JavaScript Object Notation).
The SPA model has been possible for a number of years but has generally relied upon active components such as Flash, Silverlight or Java Applets. These technologies are essentially programs that run inside the browser container and tend to face issues with operating system support and related problems that have limited their adoption. The much better approach would be to provide the rich interactivity associated with active component technologies while only using standard HTML, CSS and JavaScript. The next evolution of HTML and related technologies, known collectively as HTML 5, promise significant improvements in the flexibility of standard HTML-based user interfaces but, at least in my view, it is a tangential and somewhat independent development that is bringing us closer to rich HTML interfaces even faster.
The barrier until recently has simply been the JavaScript programming language and its inherently unwieldy programming model. I would bet just about anything that the original creators of JavaScript would have scarcely imagined the uses to which this basic scripting language has been put in the past few years. Originally created to enable basic interactivity within a web browser, the need to satisfy increasingly sophisticated application designs has driven this humble technology to its limits. The result is that few people have the patience to master it in any real sense and applications developed from it tend to be messy and difficult to maintain. I recall a technical conference that I attended several years ago where the presenter asked for raised hands to identify anyone in the audience that could say they really program with JavaScript rather than just copy and paste snippets to emulate an effect from another web site. When two or three out of hundreds of attendees raised their hands, the presenter asked them to stand so that everyone else present could see who they are copying from.
The big shift that has accelerated the development of highly interactive web applications despite the limitations of JavaScript is the evolution of JavaScript libraries that take much of the pain out of working with the language. The amazing thing here, to me at least, is that the large and rapidly growing number of high-quality and widely adopted JavaScript libraries came not out of the commercial pipeline but rather from the open source community. Libraries such as JQuery are among the first to start this trend and remain vital tools in simplifying JavaScript development. More recently, frameworks that were once only found on server-side platforms are now making their way into JavaScript libraries such as JavaScriptMVC and Knockout. These frameworks go a long ways towards bringing JavaScript development much closer to the realm of standard, mainstream programming languages such as Java and C#. In doing so, they make practical the SPA style of application, dramatically closing the gap between the traditional desktop application and the web application.
One of the most impressive videos that I have seen on the SPA development paradigm is this one by Microsoft developer Steve Sanderson. It does spend a little bit of time promoting recent advancements on the Microsoft server-side development environment known as ASP.NET MVC, but more interestingly it illustrates the exciting advances in JavaScript libraries that enable extremely advanced single-page applications for web and mobile platforms. I highly recommend this video for anyone interested in the SPA movement as it does a far better job than this blog entry did of explaining what is possible with this new approach to web applications.
There are also innovations on the server side of the SPA programming model that are worthy of note. One of the most interesting to me is Node.js. I am planning to write my next blog posting on this technology as it really deserves a topic of its own.
