Tuesday, June 10, 2008

Web Applications the Right Way

A few years ago I didn't believe that the web platform could offer the functionality required for serious applications. I have a different opinion now, primarily based on my experience with three technologies with which every web developer should be familiar.

CSS (cascading style sheets) is a technology that allows the visual layout of web pages to be specified independently of the structural layout. Using CSS, you keep the HTML code that defines your content clear of formatting commands. This provides tremendous power to present that content in many ways without having to re-code the web page. You can overlay elements, move them around, animate them, and perform almost any visual manipulation you can imagine. If you want to see a cool example, check out CSS Zen Garden; this site lets you select different style sheets and apply them to the same base HTML document, showing the tremendous creative flexibility that CSS provides.

Asynchronous Javascript and DOM (document object model) manipulation allows a web page to respond to user input and other stimuli by asynchronously calling remote logic and re-drawing itself. This is tremendously faster, more efficient, and more secure than the old school approach of requesting new pages to be shown. User-perceived response times go from seconds to milliseconds. Another bonus is that you don't have to worry about the dreaded 'back' button — since you're not loading new pages as the application runs there's nothing to go back to!

JSON (Javascript Object Notation) enables efficient data transfer between client to server with almost no coding. Simply take an object and flatten it as a JSON string with one function call. On the other side of the connection, use a complementary function to re-inflate the object and start using it in your program. Way, way simpler than messing with XML. And it works with almost any server-side language, so encoding PHP or Python objects in JSON is still just as easy as Javascript. See the JSON.org web site for more information.

Using these technologies, I think that building a significant application using the web browser as your front end is not only possible, it's almost easy.

No comments: