Web site and application used to be built as following :
- On the server side, you had all the data, all the logic (what to display and when) and at the end, the server push the answer
So we all know client/server apps.
Now, for a few years, we have a rise :
- SaaS services (Flickr, Delicious, Salesforce, etc)
- Web 2.0 and the mashups effect : you want to retrieve on one page your latest photos, aside your latest marks or latest custom requests, all coming from differents places
That's only feasible thanks to API, which allows interactions between some services/softwares over the net and retrieve data you will aggregate and use as you like.With an API, you can get / create / update / delete data in a system.
- Mobile apps, which are on the client side and are able to get data from somewhere over internet and display what you expect and of course manage some offline features so thar you app may work even if you have no connections.
- HTML5 and its ability to provide especially some local storage and offline management, with a consequence that you can do more on client side, as for mobile.
- Have a look at AngularJS or BackboneJS which are HTML/JS framework to build web apps, on client side. See the AngularJS demo app you will build during the tutorial. Everything is done on client side, including search / sort, getting phone list and displaying phone details. For data, there are a few JSON files to provide data in a structured way.
The consequence of this shift is that you can move all or part of the logic on the client side. You need to be able to fetch/retrieve your data over the network, then apply the logic and render the content & layout to the user on client side, whatever it is a browser, a mobile phone.
So let's imagine you plan to build a new application and know that you will have several devices to support, you could change the architecture as follows :
- On backend side, just define an API to expose your data as you will use them, with some authentication & authorisation of course
- On client side (web / mobile / ...), build an app/web app that will connect to your API and consume the data and render it as expected.
In a article in French called "From mobile to web" where the same principe is used (API on one side to provide data and a web app on client side), it even goes one step further by imaginting a single app that will autodetect if you use a mobile or desktop browser and then render the appropriate display. I'm not convinced it's the best solution as it could make your code quite messy.