Spent a whole weekend trying to build a simple mobile web application using Google's AppEngine as my web server. Took this initiative to simply know what its like building a mobile web applications, how is it different from doing traditional web applications. I did spend time googling and learned about a couple of things:
a) How ajax was made more convenient for web developers?
There are several libraries which abstract the usage of the XMLHttpRequest object. On different os platforms we have different ways of instantiating this object. But most libraries abstract this leaving you to only concentrate on what service you call, what data you send, and what to do once you get a response back. There are many libraries, like jQuery, Prototype, and YUI libraries which hide complex details enabling the developer to make high-end ajax invocations by supplying classes.
$.get( 'sample.jsp', ResponseHandler);
But most of these libraries are bulky. They are designed for popular browsers like Firefox, Safari, Internet Explorer, etc. Do you think you can use these libraries for your mobile web page? Do you need such heavy libraries again?
b) How does the mobile platform differ?
Mobiles phones possess limited computing power. The processors inside phones are designed to make optimum usage of memory and other resources. A simple operation like adding might take more cycles than a normal desktop computer CPU would. More the number of cycles means more energy is consumed. Hence programs written for mobile phones must be written/used in such a way that they utilize less power.
c) Designing your web applications so that your phones take less power
This essentially means making your mobile phone processors do minimum work to the core. But developers don't freak about and measure cpu cycles to know if their web application is running fine! Instead they simply serve more html. For e.g. if its some kind of report you have to serve to a mobile browser; html-ize it. If there is some “work” that has to be done at the client end for this report – minimize it.
d) AJAX does help those who support it.
There are some mobile phone browsers that don't have AJAX capability. Web applications for such phones have to be designed to utilize a postback model of serving requests. Almost every request is an HTTP POST; hence the browser has to refresh the screen, and then load new contents, etc. This obviously consumes more power. Such levels of consumption can be drastically brought down if those requests were served in an ajax-ed manner.
e) Do remember all those poor GPRS networks...
This contradicts with point c. Although its ideal to serve as much as html, one has to realize the time it would take to for that data to reach the browser. Most GPRS networks have very limited bandwidth, and hence sending a lot of data for the page to load isn't all that a good idea. So in this light we must send minimum amount of data to the browser. In fact JSON could do a great deal in this sphere. But then its up to the developers fair judgment to find the right balance. And once you learn it, it won't be all that difficult.
Conclusion:
As far as points c & e are concerned I just feel that the first law of thermodynamics can be neatly taken note of...
Happy programming :)
1 comment:
Scratch scratch %(
Post a Comment