Single Page Web Application (SPA)
Single page web applications are the future of interactive web application development.
- Home
- Single Page Application
Using SPA Web Development to Create a Richer User Experience
Most computer programmers learn to program in a native application development environment such as Windows,
Apple, or Unix, using structured languages such as Java, and C. These environments provide the developer with
persistent memory structures, which the developer has access to during the entire running of the program they are
developing. The developer might decide to have local variables within methods and objects but they have the
option to store application state in more global areas as well. This kind of control and persistence of state has
made it possible for the creation of operating system based programs which provide the user with a rich and
powerful interactive interface. Video games, word processors, and graphic design programs all rely on this persistence of memory.
In contrast to the native application development environment, there is the environment of the world wide web, and
the internet browser. Browsers are designed to present web pages in a stateless way, where every web page loaded
is a completely new world independent of the previous page. This is a satisfactory paradigm for static content pages but a
horrible one for interactive web applications. Imagine having to save your document and reload your entire word
processor program every time you go to a menu item, and you have an idea how inefficient this kind of architecture is.
To deal with the
full page refresh
world of the browser, web application developers
use what amounts to an ugly hack. Every time the user switches pages they send all the input the user has entered on
that page to the server. This input is sent regardless of whether the user is done with that page. In fact, often the user
is only making a side trip to look up information from a list which will be entered into a line on that page when they return
to it. The resulting user interface created by this architecture is slow and inflexible, plus all of these extra round trips
require the web developer to write a lot of overcomplicated and confusing code. This is why web applications are less
user friendly than native applications and also more expensive to build.
Now it is time for the hero to enter this scene, the Single Page Web Application (SPA). The idea is so
ridiculously simple that one wonders why web applications weren't written this way all along. The solution to losing
all of the state on a web page when switching pages is just to stay on a single web page the whole time. Javascript
and AJAX make it possible to pull in new content without leaving the page so a full page refresh is no longer necessary.
The idea of a SPA web application is not entirely new. Looking through some of the links provided below one can see it
has been around for several years. So, why hasn't it caught on? The main reason is that almost everyone developing
frameworks for this paradigm has their mind hopelessly clouded with the idea of
JSON architecture.
They are taking the SPA idea too far and trying to completely emulate the old world of client-server architecture where only
data was sent between the client and the server. Even worse is the idea of three layers of architecture on the browser in
javascript, coined as javascript MVC. Three layers of architecture on the browser in javascript?! Are these people kidding us?
No wonder the SPA idea hasn't taken off. Here is an article that gives a good run down of these interesting but, in my opinion,
hopelessly overcomplicated solutions.
Swizec Teller On Single Page Web Applications
WebRocketX instead keeps things as simple as possible. The application is run out of a single page and updates are done using
AJAX calls, but the content is still delivered in the "old fashioned way" as standard HTML. WebRocketX helps the developer to
do all the mundane things that need to be done on each one of these trips to the server, so the developer does not need to code
them, such as controlling user interaction, handling error messages, and queuing up old content.
References On The Web:
Single-page application (SPA) Wikipedia
Single Page Application - The Worm Hole