Don't tell me you did that with JavaScript
This week I experienced something that made me feel more confident about the viability of JavaScript as a first-class language in ASP.NET development. And I'm not talking about JavaScript's capabilities — those I have re-discovered long ago — my concern had always been how well other developers in my team would receive it.
For the last few days I've been meeting with a few other developers in my group, transitioning the support of one of my applications to them. Thanks to our quasi-regular brown-bag sessions, the understanding and acceptance of some architectural traits of the application, like the Repository Pattern and use of IoC containers (Castle Windsor in our case,) were fairly painless.
I always carried that uncertainty that when I started reviewing those .js files with them things could get ugly. These developers are pretty bright, real .NET ninjas, but hadn't yet used a JavaScript library like Prototype (or YUI or jQuery or MooTools or [insert favorite here];) and I used Prototype and script.aculo.us heavily in this project — which should not come as a surprise given some of my involvement with that library.
Unfortunately, without getting into too much analysis of teams and project management, I worked pretty much solo on this project, without enough code reviews and, heaven forbid, zero pairing sessions — again, that's not the point of this post; it's definitely the big reason behind my anxiety, but let it alone for now.
The day finally came for me to explain the UI portion of the application. Everyone thought the richness of the UI, the carefully applied visual effects, and the generally pleasant user experience were very interesting and they were curious to learn how it had been done. They knew I was using some JS library thing but I'm pretty sure they had never seen JavaScript applied to that extent.
I started explaining what is the most important thing for me, that you definitely need to use JavaScript libraries and that it is important to understand the language a little better. Without getting into a JavaScript lecture, we started discussing some of the basic features of Prototype, its global functions, why it does what it does to the native objects, and how JavaScript makes all that magic possible.
As soon as I started showing how clear and well-structured good JavaScript code could be I could see the light bulbs go off and some of those folks — that I knew feared JavaScript for being an unmaintainable mess — suddenly realized that there was this whole new world of production-grade, nice on the eyes, and expressive JavaScript code and techniques that they had been missing out the entire time.
I'm not done showing all the Prototype features used in the project yet, but I'm sure we will cruise through them and also script.aculo.us. Who knows? Maybe we even spend some time understanding JavaScript and its oft-misunderstood prototypal-inheritance model.