Presentation and Business Separation
I like Gmail and think it s a pretty cool online application. In general none of the technology that makes it run seems particularly new to me however they do some stuff in the code that is pretty far out. For instance, when composing an email there are some links for adding CC addresses or BCC addresses as well as a link to check the spelling of your current composition. But, in reality they aren’t links at all. They are just plain text styled to look like links.
Oh, I’m sure that once it loads and the javascript that runs is done the text becomes a link but in the source code its just a styled span with the all important id field filled in. My guess is these guys have taken the idea of unobtrusive javascript to its absolute end and made everything work this way. Basically, what I presume is that during the onload event the Gmail guys latch onto the DOM and replace text or attach links to text all over the place. But why would they do this?
Well my first guess is for maintainability. So long as all of the object IDs are well documented the Gmail coders never really have to mess with the HTML that is in place on the page. The interface is thus defined and any code that needs to fire off due to actions on interface objects can be modified, added, and removed without ever touching the HTML in the page. This is a pretty revolutionary way of looking at building a web application to me. I mean, I always hear about separating the presentation layer from the business layer but this is the most complete separation I have ever seen on a website.
Google doesn’t stop there though. It’s actually pretty cool. Not only do they just create HTML (that may or may not be semantically correct – that’s a whole different story) but they style it all with CSS and created an entire application/database interface abstraction in JavaScript. I’m almost inspired to try to do the same thing on some future application. Well, almost – except that folks who don’t have Javascript available to them would be locked out of my application. A quick test confirms that Gmail requires javascript – a “luxury” I never have.
I have to say I’m pretty impressed with the engineering that went on with creating Gmail in the fashion that they did. I would love to see the documentation and source code just to see how managable the process is and how maintainable it all turns out. It seems like it would be both very managable and maintainable and it is an idea I will file away for when I have the same luxury of ignoring accessability