Monday, August 07, 2006

Joel, MapReduce, Javascript Closures, Flanagan

{

Older news is that Joel posted an excellent essay called Can Your Language Do This? where he walks through some of the basics of passing function references around in Javascript. I'll beat my old drum and say that Javascript is an intricate, powerful language.

The timing for the article is great because I'd just recently used function references as an approach to handling some client side script that needed to be synchronous. In the application we use a popup window that is launched in javascript and then based on some input from the user we pass back information to the page so that it can know how to proceed. The problem with this approach, however, is that a popup window is a disjointed entity from the page it popped up from and the thread that invokes the popup will not wait for the user to close the window before continuing with the rest of the javascript. My solution was simple: pass a callback function to the popup and use that to make sure the user interaction was finished before proceeding with the parent page's code.

Another essay I managed to finish over the weekend that runs along the javascript and functions as datatypes is Javascript Closures For Dummies by Morris Johns. Concise with beautiful typography.

One final thing: David Flanagan has a 5th edition of his Javascript book coming out from O'Reilly this month. I'm excited to see what his treatment of the latest developments such as Ajax will be. It will be painful to be buying that book for the third time, but if I get even a piece of the mileage I got out of the 4th edition, it will be well worth it.

}

No comments: