If you want to learn how to put the Yahoo! User Interface (YUI) Library to work in your web applications, this book definitely can help you get started.
The author, Evan Goer, brings the right credentials to the pages. He is Principal Technical Writer at Yahoo!, where he works for an engineering team that develops Yahoo’s internal deployment structure. He also works with Yahoo’s YUI core engineering team.
His YUI 3 Cookbook focuses on using YUI’s tools to solve a wide range of problems that can crop up while cranking out new web apps. The 406-page book is written clearly and illustrated with numerous code samples. It follows a problem-solution-discussion approach and is divided into 12 chapters:
- Loading Modules
- DOM Manipulation [DOM = Document Object Model manipulation]
- UI Effects and Interactions
- Using Widgets
- Server-Side YUI
- Universal Access
- Professional Tools
For example, suppose you have used a prepackaged software widget and then had to modify it, and now you are locked into kludged code that will be difficult to maintain or extend.
Goer notes that YUI avoids lockin, because “every component in YUI is designed for extension. Every YUI widget shares the same solid API core and offers the same extension points, including a common rendering lifecycle with standard hooks to intercept or override. YUI lets you extend components in a classlike hierarchy, mix in new methods and properties, plug new behaviors into instances, and even inject arbitrary behavior before and after methods. In short, there is always a clean way to extend a YUI component instead of creating an unmaintainable mess.”
He highlights several other advantages of YUI and emphasizes that “YUI adheres to the bizarre, unfashionable philosophy that library code should, as much as possible, run as-is in a wide array of environments. This is actually a bit confusing to developers, who tend to assume that since there is no ‘YUI Mobile’ fork of the library, that must mean YUI doesn’t work on mobile devices. In fact, the YUI team tests all library code on a wide selection of mobile devices, and adds methods and synthetic events to help you abstract away differences between platforms. Likewise, YUI runs in a Node.js server environment as-is. There is no YUI Mobile Edition or YUI Tablet Edition or YUI Server Edition. There is just YUI.”
Goer concedes that many people use jQuery “to build beautiful pages every day” and likely would wonder why they should use YUI, instead.
“YUI,” he emphasizes, “focuses on keeping the complexity of web applications from spiraling out of control. Its key strengths are modularity and structure.”
— Si Dunn