The New Yahoo! Front Page and YUI 3.0

yahoo

At the beginning of this year, the Yahoo! Front Page team embarked on an ambitious project to completely remake the face of the company. The goal was to make the Front Page into the most important starting point on the web while also showcasing Yahoo!’s commitment to openness. From the engineering team’s perspective, this meant turning the Front Page into a framework upon which Yahoo! and its partners could build new functionality and experiences rapidly.

Thinking of the Front Page as an application framework led us down some very creative paths. On the front end, we quickly came to the conclusion that a JavaScript framework would have to be developed to run the page. Steve Carlson, my colleague and partner-in-crime on Front Page, and I then spent weeks hashing through use cases, developer needs, and design patterns. Instead of starting from scratch, we decided to start with the YUI 2.x-based framework we had used on My Yahoo! and evolve it into a more complete solution. After reviews with various architects and stakeholders, we had a working design that we could implement. The only question left was which library to build the new framework on.

The natural approach for building new JavaScript frameworks at Yahoo! is to start with YUI as a base, and that has typically meant the 2.x version. As an adjunct member of the YUI team, however, I was privy to some information surrounding the development of YUI 3. It turned out that YUI 3 was going to be developed simultaneous to our development of the new Front Page. I sat in on several reviews with YUI 3’s principal architects Adam Moore and Matt Sweeney, talking through some of their plans for the library. Their departure from the approach used for the 1.x and 2.x releases of the library made a lot of sense to me and seemed like a natural fit for what we were doing on the Front Page. Steve and I both felt that building on YUI 3 would make implementing our design much easier based on several goals that we had for the framework:

  1. Eliminate global dependencies. We wanted each part of the page to operate separately from all of the others. Each part should have no knowledge of what else is on the page and therefore can’t depend on objects to be globally available. The 2.x library is based on the global YAHOO object, which we would have had to abstract away; the 3.x concept of YUI instances that could be individually manipulated worked perfectly to achieve this goal.
  2. Make it small, make it fast. The Front Page can’t afford to be slow, so we needed to have as little code as possible to get everything up and running. YUI 3 impressed us with its organization into small, atomic units that allowed us to specifically include parts of the library that we wanted while eliminating parts that were unnecessary. Further, one of the goals of YUI 3 was to optimize for runtime execution and make it faster than the 2.x version. Once again, YUI 3’s approach was directly in line with the Front Page’s goals.
  3. Create version independence. From the start, we didn’t want to have dependencies on specific versions of YUI components as this can lead to maintenance issues. What we really wanted was for each part of the page to be able to use whatever version of the components that they wanted. The sandboxing feature of YUI 3 opened up the possibility of having two (or more) YUI instances each loading different versions of various components while not interfering with each other.
  4. Allow code portability. Having worked at Yahoo! for a combined five years, Steve and I knew that anything we put on a Yahoo! property could be a candidate for porting to someplace else. We knew that this possibility meant the code had to stand on its own and not make assumptions about the environment in which it was placed. We thought about the most difficult environment possible: a locked-down browser environment where the JavaScript code has no direct access to the DOM. Since YUI 3 can abstract away the DOM through its Node interface, we had the entrypoint necessary to make this requirement a reality.
  5. Be forward compatible. The project to create a new Front Page is an incredibly long one and we wanted to be as forward-looking as possible. We knew that if we created the framework on YUI 2.x that we’d be hard pressed to get time to upgrade later on. By building on YUI 3 from the start, we eliminated the need for developing an upgrade path later on.

The YUI 3 story was incredibly compelling to us and was clearly inline with all that we had hoped to achieve in developing the new Front Page. Our recommendation wasn’t without controversy, however, as YUI 3 was just beginning development. This meant not only was there very little usable code but there was also no documentation. Further, our developers were already familiar with the 2.x version of the library and not at all with the 3.x version. Both teams knew that the only way to make this process work was full cooperation with each other.

We setup weekly check-ins between the Front Page and YUI teams to track progress, bugs, and determine which features from 2.x to port next. In essence, the new Front Page and YUI 3 were developed hand-in-hand in a mutually beneficial relationship. The YUI team provided regular drops of code completely out of their planned release cycle and the Front Page team, in turn, provided feedback on what was and wasn’t working with developers. There were some growing pains for both teams as that feedback sometimes resulted in interface changes, but ultimately we all knew that this was making both products better.

What began in January 2008 as two separate projects, the new Front Page and YUI 3, has turned into a joint effort to create the best start experience on the web and the best front end library for web developers. With each project informing the other, we’ve seen the new Front Page go into testing and the YUI team publish its first preview release of YUI 3.0 in the past couple of months. Both represent major steps forward in their respective parts of the company and neither would have been possible without the other.

The Front Page team is proud to have the first site running completely on YUI 3; if it works for us and our strict requirements and scale, we think there’s a good chance it will work for you.

Note: The new Yahoo! Front Page is in bucket testing right now and there’s no way to self-select into the bucket test.