It’s been some time since my last post, I feel a little rusty, but I was busy working and learning new stuff. This post will be an abstract thing, and I’m going to quit thinking of a song title-like post titles from now on…
The common web sites work like that (using HTTP):
1. Client makes HTTP request to the server, server responds with the page.
2. User click a link on the current page – new request, new page from the server and so on.
The idea is that the client gets the information on pages, request – whole page, request whole page. But if there is a little change on the current page and we want to see that change, we will have to reload this whole page by following this model. So what to do?
So imagine a single initial request that downloads a page. This page is the application. Everything else is AJAX requests and loading data represented in some format from the server.
So the model here is:
1. Client makes HTTP request to the server, server responds with the application.
2. The client application asks server for data and markup when it is needed.
OK, now why we need such a thing?
We can take a look back and we’ll see that the Single Page Application for the web is not a new idea, for example the Java Applets were exactly desktop apps in the browser, the Flex/Flash applications too, Microsoft has their Silverlight, etc.
We can see that people tend to use the browser for almost everything, as time passes I realize that I don’t want to install desktop applications and I want my apps to be OS independent, the browsers are getting more and more capable to be Operating System in the Operating System, OS in the OS if you want… We use Gmail (SPA), mail client (I prefer it over Thunderbird), we use Google Drive, we use Pivotal Tracker, we use e-book readers for the browser, we use MP3 players for the browser, there is the Chrome Store (Every browser tends to have something as a store for plugins and apps), there are the Chrome Book Notebooks (ahead of their time in my opinion, btw)…
Additionally, as a developer I see how the clients want more and more Single Page Applications. They are more flexible and easy to use by their employees and users.
So my thoughts are that the Single Page Applications are tightly bound to the future of the web.
But how to code something like this. It is not so easy as a common web site.
But as it was for the server side in the recent past : PHP, JSP, ASP – one application is written entirely in one layer and in one file – BAD;
The applications is divided to layers and files, convention over configuration, do not repeat yourself, test driven, etc – Rails, Django, Spring, Symphony, Play, etc – GOOD,
we have frameworks that will help us code a good Single Page Application now.
We have Ember JS (by some contributors to Rails), Angular JS (by Google), Can JS, Backbone, GWT, etc.
The web is growing and everything is getting more complex, the needs of the clients are changing, and there are frameworks to help us, as developers, to adapt.
So I wanted write about the Single Page Apps, because I’m doing a lot of applications like that nowadays and maybe I’ll write about Ember Js and its integration with Rails or Node’s Grunt soon… I hope you found something new in this post. Cheers until the next one!!!
PS. I didn’t forget the Websocket protocol (it is for another post).
- Single Page Application in Wikipedia – http://en.wikipedia.org/wiki/Single-page_application
- Ember JS – A Framework For Creating Ambitions Web Apllications – http://emberjs.com
- Angular JS – HTML Enhanced For Web Apps – http://angularjs.org
- Can JS – Build Better Apps Faster – http://canjs.com/
- The Bulgarian Twitter page for Ember JS – https://twitter.com/emberjsbulgaria
- A SPA for reading ePUB books from Chrome (offline capability), Safari, Android and Windows 8, written by me and my colleges from Astea Solutions – Livemargin Reader Beta