Coding, is? Fun!

Thursday, November 06, 2008

Javascript Libraries

When you are designing an application there are several paths regarding the choice of UI:
1. If the application is internal to an enterprise, you can choose a desktop application. Mostly instead you choose an application delivered through the browser to avoid installations. Even through the browser, you have options like .NET Smart Clients that are opened in the browser. You have the option of Flash/Flex or Silverlight - a consistent, rich UI experience with Drag/Drop is possible in this environment. You can also choose traditional JSP or ASP.NET applications with postbacks.
2. If the application is facing public users, then most of the above options are eliminated - you have to go with Javascript/HTML/CSS - because it is the paradigm of the web.

In both the above cases, there is a reluctance to choose Javascript to build strong UI - the reason is that Javascript programming is not very type-safe. Editors are hard to come by. There is little use of intellisense. It is still seen as just a "scripting" language. In the browser, there are still cross-browser issues in DHTML, Ajax and so on.
I wrote a post sometimes back about Object Oriented Javascript - mainly talking about simple OOJ concepts. But in the past few years, almost every month someone releases a Javascript library. Javascript libraries such as prototype are immensely popular for a few good reasons:
1. Cross-browser issues are transparently handled by these libraries
2. They provide standard controls, layout managers and a great programming model.
3. They also provide means of extending such controls using OOJ.
4. They provide a custom Event model.
Thus, developers and architects dealing with decisions on web based delivery should necessarily consider Javascript libraries. Since there are hundreds of them, you should be aware of a few considerations while choosing one:
1. The libraries size matters - prototype.js is small, but UI effects needs libraries like scriptaculous. These can add to the size of the HTTP response - but can be easily managed by web server compression and caching headers. The libraries also come in a "minified" form for deployment.
2. Some of them come with complex controls that you can then extend to create your own. They are proper frameworks. You may choose them based upon your UI needs.
3. Select a library that has a popular user base. JQuery, Dojo, scriptaculous, mooTools, and the now-popular ext-js all have a good user base. Do NOT expect, though, very high level documentation.
All of these libraries provide services such as:
1. Cross-browser DHTML
2. Ajax
3. Common Controls such as trees, accordion
4. Drag and Drop and other effects that work cross-browser
5. JSON and XML support

So, if you are considering an internal or external facing website consider Javascript programming using one of these libraries. It makes life a lot simpler. You gain all of the services by including the necessary javascript files in your header.
(Also knowing one of these libraries provides a fast path to knowing others).

To start exploring, download one of these libraries and go through the tutorials. It does not take much time to figure out (particularly if you know OOJ).

Labels: , , ,


  • Now there are even more options like GWT that compile Java to Javascript and do a lot of optimizations. So you can develop and debug in familiar Java IDEs.

    By Blogger Surya, at 3:57 PM  

  • Hi Ram,

    Now if you see Microsoft Ajax 4.0 it uses Jquery and javascript library for AdoNet and Client Templates . They can calla Ado.Net data service effectively an render the html templates.So i just want to add these things with your post.


    By Blogger Thani, at 12:00 AM  

Post a Comment

<< Home