How I Finally Learned to Love JavaScript

Leonard Cohen - Songs of Love and Hate

For a long time, I stayed away from JavaScript. I would use it for very small interactions, but for major functionality like menus and UI, I stayed away. The reason was twofold:

  • Was too hard to test and get working across multiple browsers
  • Was just so confusing! Gah!

So I missed the big Ajax revolution and opportunities thereof. Even when I finally caught up with Ajax at the end of 2005, I was still trying to use cross-browser goodness via if/else statements. Even as late as 2007, my berating of JavaScript could be heard amongst co-workers. Such encouraging phrases as "it's object-based, not object-oriented" didn't help me.

This all changed when I started exploring YUI and jQuery. Each offers a way to interact with pages and their elements using JavaScript, but in a way that abstracts out the browser details and saves you time and headaches. They are tested on more browser variations than you can shake a stick at so that you can be assured that your code will still work

YUI

yuilib

YUI is the Yahoo User Interface library. It's main strength is as a toolkit of ready-made user interfaces based on common UI design patterns. It also provides cross-browser conveniences for interacting with the DOM, browser events, etc. The documentation is outstanding and it's a very robust system that allows for highly complex and rich interaction in a very short amount of time.

jQuery

jQuery

jQuery, much like YUI, is a way of using JavaScript without knowing all of JavaScript's details. It helps interact with DOM elements, events and JavaScript's power in a lower-level, abstracted way. You'll still need to know some JavaScript and about function as references and how JavaScript scopes its variables. If you're looking to drop in special UI pre-built interfaces (like YUI offers), you have a number of options: plug-ins, jQuery UI, and my favorite, jQuery Tools.

jQuery brought me back to and made me love JavaScript.

I had first heard about it through a friend and this podcast on FLOSS Weekly. Give it a listen. You may never hand-code bare-bones JavaScript again.

In Closing

What does this have to do with my startup? Because it helps you build awesome stuff for your customers faster. These tools are client-side frameworks much like there are server-side frameworks. Frameworks are friends.

These toolkits have helped me grow to love JavaScript. Although JS and I tend to still have a "disagreement" at times, our marriage is strong as long as we have our marriage counselors (jQuery and YUI), we will live long, happy lives together.

Photo courtesy fisherkiller CC BY 2.0

Next post: free software from Microsoft for your startup

comments powered by Disqus