YUI3: My First Experience
With the Yahoo! User Interface (YUI) javascript library now the library of choice at IPC I thought it was about time to start playing with it.
Background to Javascript Frameworks
My first experience of a javascript library was to build a debug console for my framework. Version one of the console was built in jQuery (v1.2, I think). I liked it. I liked how you no longer needed to repeat the same cross-browser checks every time you built something new; how effects were easy to acheive without having to create your own; chaining. Most importantly, though, I liked how the library made the development experience a little more unified.
First Taste of YUI
A few months later I decided to migrate the jQuery console to YUI2. I quickly found that the documentation was not brilliant for new-comers (and still isn’t). My migration, although worked, was not how YUI2 intended a widget to be built. Overall, it took me a lot longer to learn YUI2 than jQuery and I put this mostly down to the documentation (jQuery API docs are brilliant) though also because jQuery tutorials are abundant as are community plugins which you can rip apart to assist your learning.
Upgrading to YUI3
Last week I decided to have a go at upgrading the console to YUI3. Once again, the documentation was pretty poor for new-comers but at least this time at least I had a foundation to work with. This time I wanted to do things right. I wanted to extend the YUI Widget class and do things how YUI wanted me to do things. Just a week later, it’s done.
Benefits of YUI3
I couldn’t give you a fair comparison between jQuery and YUI, or advise you on which is the best for your project, as I’ve not kept up with the progress of jQuery. However, I’m happy YUI is the IPC standard as it’s something I’ve had a lot of fun learning and playing with.
Key components of YUI3 that I’ve come to love are:
- Loader
- Widget
- Attribute
- Event
- Node, specifically their consideration for WAI-ARIA support and Node Queries/CSS3 Selectors
Next, to get the most out of YUI3, I need to look into:
Summary
In summary, once you’ve grasped YUI and put together your first widget you’ll feel like you’ve acheived something a lot more pure, legible and stable than you do with jQuery. Or at least I do.
More to Come
Over the next few days I hope to put together some tutorials to assist people with their first YUI widget. It’s been a struggle for me to find the help I needed so, hopefully, I can help a few of you out there.
