Wednesday, May 20, 2009

RIAs powered by Dojo and javascript?

Recently I was thrown into a situation where I had to learn Dojo and javascript quickly to produce a prototype. Being fairly skilled at picking up new technologies and languages I figured how bad could it be. I was wrong! The switch from typed languages to javascript is HARD. What a terrible overall experience. I can't see how the untyped language is a good thing - so far it just lets me be lazy and not create class definitions or hard contracts (have those things really been slowing us down in the typed world?) and lets me just create functions all over the place with no clear "context" for their use. Dojo has some nice features, but it is never clear where Dojo/Dijit ends and plain javascript/Dom stuff begins. And to top it all off you need to learn at least 4 pieces of technology - javascript/dhtml, Dojo, Dijit, and css in order to be productive. This same prototype in Flex would have probably taken me just over a day to put together - instead it took me 5 days to throw some grids up on a page, populate them with data, get the layouts correct and then based upon the selection, interact with a separate flex component.

Dojo/javascript has horrible documentation and lack of good IDE support (please - don't start on Aptana or RAD - they are decent, but nowhere near as easy or helpful as Eclipse JDT, VS w/ Re#, FlexBuilder). Trying to find what the properties and methods to call on various Dojo objects was painful - the Dojo online Docs are hard to navigate - I finally resorted to grabbing the development code so I could just step through and read the comments. That should really be positioned as the primary way to figure out what's going on. Then once I found what to call, figuring out if I called it correctly was also a chore. For instance, if some function took an object that expected certain attributes, making sure I properly created it and added the correct attributes to it was mostly trial and error. Thank God for Firebug.

Now with all that bashing aside, I completely agree with the "if it looks like a webpage and talks like a webpage, then it should be a webpage" argument. Meaning, if you want your webapp to look like a web page and you have links, etc, then you should stick with the "legacy" web technologies of html/js/css, otherwise the UX suffers. When users see what look like hyperlinks they want to be able to click on them and open in new tabs, etc. They also expect that all of the other browser features, like search and bookmarks, work with their pages. That's one of the problems with Flex and Silverlight. Sometimes these types of RIAs look like what could be plain-old webpages, but as soon as you right click a link and try to open it elsewhere, or you try to bookmark something, or search for some piece of text you realize that you cannot and that can be frustrating to the user. Similarly, I think Flex/Silverlight apps that have an MDI like interface need to be careful as well. That approach basically reimplements the same functionality as browser tabs. In most cases I'd prefer to open up each doc as a separate browser tab rather than the app putting in its own top-level tab. I think moving forward it would be nice for those technologies to play a little nicer in the browser.

Hopefully I get over the the learning curve for js/Dojo soon. Most of my development in the foreseeable future will likely be using these technologies so to some extent I just need to get over it and embrace the untyped javascript world. I hope to see the light soon.

No comments:

Post a Comment