Unobtrusive JavaScript: I am a convert


Before I talk about Unobstrsive Javascript, let me give some background on my relationship with javascript.

When I started learning web application development, I wasnt new to development, i came from Desktop Java and C++ MFC development. I was introduced to technologies such as Servlets, XML, XSTL, HTML, (early) CSS, and of course Javascript. The first thing I learned about Javascript was not to use it.



Enter Unobtrusive JavaScript

I am now sold on using javascript, but Unobtrusively. I think that this is one of the best web development methodologies that I have seen in a few years. I am already spinning from the AJAX shock, and coming to terms with Javascript as a first class language. But I could not shake the feeling that javascript is secondary, not primary to web development. Unobtrusive JavaScript (as well as AJAX) as made me see javascript for what is really is, a very powerful and useful first class higher level langauge. First class, meaning it stands along side of Python, Ruby, PHP, etc as a useful language. After looking at the Javascript 1.8 Spec (and reading about Javascript 2.0), Javascript has powerful language features on par with many modern high level scripting languages. I didnt realize that javascript had Try/Catch exception handling, and other language features carried over from java, and anonymous methods ( lambas, passing of code blocks).

After getting past my "irrational" dislike of Javascript, It dawned on me how powerful and useful the language is.

Its The Client Stupid!

Becuase Javascript's main usage is for browser scripting, Javascript still should be relegated to "enhancements" for websites. I am a firm believer that for the majority of websites Unobtrusive JavaScript is an awesome idea. Clients may have Javascript Turned off, Or not support the Javascript feature you are using.

I do think there are special cases, where an entire application can be created using a Javascript/HTML/CSS/ mixture. Silverlight, Adobe AIR and other web frameworks attempt to make this easier by standardizing some functionality....of course its only standardized if the browser being used has support for Silverlight or Adobe AIR.


Converted
I am now a convert. I still will not rely on Javascript for data validation. It will always be server side, as with Unobtrusive JavaScript the site must be useable without javascript. Also, with the advent of things like Fire\bBug, and other powerful javascript debuggers, you're asking for trouble if you are not validating 100% on the server side. With that said, you can still provide users with a more responsive interface, using javascript to validate, but depend on that validation.

http://simonwillison.net/static/2008/xtech/





Comments

Popular posts from this blog