Server-side v.s. Client-side
Before moving on, it is true that this requires a paradigm shift if you have been working on traditional web applications for a while, specially if you have never used a Model-View-Controller approach. If you have never heard of, or used Model-View-Controller, I’m afraid there is some reading to be done before continuing. But hey! You can start here, or else you can continue reading this incredibly sexy article.
With all the presentation logic being handled by the browser, where does the data we see on the UI coming from? It comes from the server; that is the real use we have for it. The controller at the browser is the one responsible for this channel of communication; it retrieves data from the server each time the user pages through a data grid and sends data to it whenever the user needs to create or edit information. JS Apps work in a similar way to smartphone apps, in which a client runs on the phone locally and it uses data coming from a remote server. In fact, there are specialized build tools, like PhoneGap, that creates applications to be installed on a smartphone from HTML/JS/CSS3 sources.
Pros & Cons
While JS Apps goes far off any conventional use of a browser, it offers several advantages:
- Rendering of pages and templates is done by the browser in the client computer, taking advantage of the client computer’s processing power and leaving less workload on the server.
- Completely decoupled from the server logic.
- Less calls to the server, since it is only accessed to get data and not pages in every possible display state it might have.
- High separation of concerns, since the server ONLY handles business logic and not UI-related validation and such.
- Easy unit testing of the user interface and UI logic.
Also, it might represent some disadvantages:
Sounds Kind of Interesting, Now What?
OK, now that you might get the picture of what a JS App might look like and its advantages, so the next step would be to analyze the technologies and frameworks you could use, getting your hands dirty along the way so you can start developing this kind of applications.
So, stay tuned for more articles! 😀