Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Sergio Pereira

There are no half-solutions because there isn't half a problem


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.


Published Aug 22 2008, 04:35 PM by sergiopereira
Filed under: ,

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# August 23, 2008 12:01 AM

Books and bits » Blog Archive » On Sergio Pereira’s - Don’t tell me you did that with JavaScript said:

Pingback from  Books and bits  » Blog Archive   » On Sergio Pereira’s - Don’t tell me you did that with JavaScript

# August 23, 2008 12:22 AM

Dew Drop - August 23, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - August 23, 2008 | Alvin Ashcraft's Morning Dew

# August 23, 2008 10:17 AM

Chris Sutton said:

That's great to hear that it made sense without that much effort. I think most people still remember the pain of Javascript back in the late 90s and early 2000s and don't realize that things have really changed for the better in terms of Javascript development.

Chris

# August 23, 2008 11:12 AM

Pessimist said:

I just hope that enough .NET developers realize that Javascript can be useful, before Silverlight comes to wreck the web party.

# August 23, 2008 4:50 PM

sergiopereira said:

@Pessimist

Do you think these same developers that have been avoiding JavaScript will jump on Silverlight? I have the feeling that sooner or later we will see something stupid like ASP.NET controls to wrap Silverlight grids, trees, menus, etc (they might already exist, I'm not paying attention to that yet). Then we could say "Hey, I did all that without writing a single tag of Silverlight/XAML)... I rock!"

For this kind of web developers, both JS and SL don't matter.

# August 23, 2008 5:05 PM

Ivanski said:

The fear of javascript is such a common thing that I come across - all of my current colleagues 'hate' javascript (except the few I have partially converted).

It's no surprise when it's used the way it normally is in web pages - global variables, global functions, no encapsulation, no chance for any form of reuse, etc.

Javascript isn't hard, it isn't weird or strange.  What's weird and strange is the way we tend to use it - in a very similar horrible, nasty, coupled-to-death way we used to use ASP and JSP.

Learning to use the language better and wrapping your head around one the libraries you mention make the whole experience sane, productive, testable, maintainable and cross platform - this hold true for any language, not just Javascript.

I think you should push harder for code reviews and a little pair programming, but I suppose you can't have everything all the time.

Thanks for the article.

Ivan

# August 23, 2008 6:21 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Proudly Partnered With