YUI 3 Cookbook – Keep your web apps from spiraling out of control – #bookreview #yahoo

YUI 3 Cookbook
Evan Goer
(O’Reilly, paperback, Kindle)

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.

He describes YUI as “a powerful open source JavaScript and CSS toolkit for building web applications.”

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:

  1. Loading Modules
  2. DOM Manipulation [DOM = Document Object Model manipulation]
  3. UI Effects and Interactions
  4. Events
  5. Ajax
  6. CSS
  7. Infrastructure
  8. Using Widgets
  9. Utilities
  10. Server-Side YUI
  11. Universal Access
  12. Professional Tools

“While YUI is succinct enough for ‘light’ JavaScript work,” Goer writes, “where it really shines is in providing a solid foundation for more maintainable code.”

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


  • Si Dunn is a novelist, screenwriter, photojournalist, and book reviewer. His published books include: DARK SIGNALS, a Vietnam War memoir; ERWIN'S LAW, a private-detective novel; and JUMP, a novella about a combat veteran suffering from PTSD and alienation while trying to work for newspapers as a journalist. Several of his feature screenplays recently were under option to movie producers. He spent nearly 15 years working as a technical writer and software tester in the telecommunications industry. His current programming interests include Go, JavaScript, Python, R, Angular, and other languages and frameworks. He is a U.S. Navy veteran and a graduate of the University of North Texas.

Leave a Reply

%d bloggers like this: