108
Nate Koechley – [email protected] Yahoo! vs. Yahoo!: Case Studies Yahoo! vs. Yahoo!: Case Studies Nate Koechley Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team Platform Engineering Group Yahoo! Inc. Slides http://nate.koechley.com/talks/2006/12/webbuilder/ Contact http://yuiblog.com [email protected] http://developer.yahoo.com/yui Web Builder 2.0 Las Vegas

Nate Koechley – [email protected] Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Embed Size (px)

Citation preview

Page 1: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Yahoo! vs. Yahoo!: Case StudiesYahoo! vs. Yahoo!: Case Studies

Nate KoechleyNate KoechleySenior Engineer & Designer, Yahoo! User Interface (YUI) Library TeamPlatform Engineering Group Yahoo! Inc.

Slideshttp://nate.koechley.com/talks/2006/12/webbuilder/

Contacthttp://[email protected]://developer.yahoo.com/yui

Web Builder 2.0 Las Vegas

Page 2: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

My PerspectiveMy Perspective

Charter member of Web Development team at Yahoo! In the trenches and in management Currently:

– Yahoo! User Interface (YUI) Library team– Senior Front-End Engineer, Technical Evangelist, Design

Liaison, YUIBlog Editor– Responsible for Yahoo! Browser Support specs

Strategy and Direction

Page 3: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 4: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 5: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Page 6: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 7: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 8: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 9: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

YUI: The Yahoo! User Interface LibraryYUI: The Yahoo! User Interface Library

Page 10: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

The DHTML UniverseThe DHTML Universeby Dojo’s Alex Russell (work in progress) by Dojo’s Alex Russell (work in progress)

http://alex.dojotoolkit.org/DHTML_universe.pdf

Page 11: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1123456782345678

Page 12: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1122345678345678

Page 13: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1212334567845678

Page 14: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1231234456785678

Page 15: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1234123455678678

Page 16: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1234512345667878

Page 17: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1234561234567788

Page 18: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1234567123456788

Page 19: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

A Great Community at Yahoo!A Great Community at Yahoo!

(praise them – blame me)

Page 20: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

A quick history:A quick history:

Page 21: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

A bit of evolution over the years…A bit of evolution over the years…

Page 22: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

A bit of evolution over the years…A bit of evolution over the years…

Page 23: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

1997

A bit of evolution over the years…A bit of evolution over the years…

Page 24: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

1997

2000

A bit of evolution over the years…A bit of evolution over the years…

Page 25: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

1997

2000

2002

A bit of evolution over the years…A bit of evolution over the years…

Page 26: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

1997

2000

2002

2004

A bit of evolution over the years…A bit of evolution over the years…

Page 27: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

1994

1995

1997

2000

2002

2004

Today per month:

188m users

5.2 billion hits

A bit of evolution over the years…A bit of evolution over the years…

Source: Comscore, Feb. 2006

Page 28: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Video: http://nate.koechley.com/talks/2006/12/webbuilder/Yahoo-vs-Yahoo/fp_2.avi

Page 29: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

It is immensely telling that the new Yahoo!

homepage is a DHTML and Ajax homepage.

Page 30: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Why is this noteworthy?Why is this noteworthy?

“Content delivery” to “software development”

Browser as application platform is “the most hostile environment possible”

Massive edge-case populations

Page 31: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Page 32: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

“Getting It Right The Second Time”

“Getting It Right The Second Time”

(matt sweeney)(matt sweeney)

Page 33: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Three Case StudiesThree Case Studies

Page 34: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Case Study #1Case Study #1www.yahoo.comwww.yahoo.com

History–From scratch

Massive Scale–5.2 billion views / month

–188 million unique users / month

DHMTL and Ajax Implementation

(all data from comScore)

Page 35: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]: http://nate.koechley.com/talks/2006/12/webbuilder/Yahoo-vs-Yahoo/fp_2.avi

Page 36: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Case Study #2Case Study #2photos.yahoo.comphotos.yahoo.com

History–From scratch

–Agile design and development project

Massive Scale–30 million unique users

–2 billion photos

Major DHTML and Ajax Implementation

Page 37: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Case Study 2:Case Study 2:

Yahoo! Photos BetaYahoo! Photos Beta

Video: http://nate.koechley.com/talks/2006/12/webbuilder/Yahoo-vs-Yahoo/photos3_2.avi

Page 38: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Case Study #3Case Study #3mail.yahoo.commail.yahoo.com

History–Beta release about 1.5 years ago

–Legacy-ish! (was Oddpost.com since 1999)

Massive Scale–World’s largest email provider ~257MM

–Available in 21 languages

Preeminent DHTML and Ajax Application

Page 39: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]: http://nate.koechley.com/talks/2006/12/webbuilder/Yahoo-vs-Yahoo/mail_1.avi

Page 40: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

(Don’t worry – not a product pitch)(Don’t worry – not a product pitch)

Page 41: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

42Nate Koechley – [email protected]

Common Goals:

Page 42: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

43Nate Koechley – [email protected]

Common Goals:

1) Performance

Page 43: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

44Nate Koechley – [email protected]

Performance:

time-to-painttime-to-onLoadspeed on the wirespeed of development memory & CPU footprint

Page 44: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

45Nate Koechley – [email protected]

Common Goals:

1) Performance 2) Interactivity

Page 45: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

46Nate Koechley – [email protected]

Common Goals:

1) Performance 2) Interactivity3) Make Good Choices

Page 46: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Common ApproachesCommon Approaches

NoNoNoAbsolute Pos

YesYesYesCompression

YesNoNoObfuscation

YesYesYesMinimization

YesYesYesKeyboard

NoYesYesFont-size Responsive

YesYesYesCSS Sprites

QuirksStrictStrictRender Mode

NoneXHTML 1.0 StrictHTML 4.01 Strict

Doctype

Page 47: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

toto Applications Applications

from from Documents Documents & Pages& Pages

Page 48: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

The Page—Application SpectrumThe Page—Application Spectrum

Historically Web Shallow

Interaction Simple Idioms Reading Markup + Skin Sequential Passive

Historically Desktop Deep Interaction Sophisticated Idioms Doing DOM + Ajax Contained Active

Page 49: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

ApplicationApplicationApplicationApplicationPagePagePagePage

Page 50: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 51: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 52: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

From:From:Page-GranularPage-Granular

To:To: Event-GranularEvent-Granular

Page 53: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Use an Event Utility:Use an Event Utility:

No JS in markup attribute space Many great utilities

– Dojo– YUI Event Utility– many more…

Watch out for memory leaks!!! (yes, three !’s)

Page 54: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Event AttachmentEvent Attachment

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Page 55: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

What happens as your app gets more complex?

What happens as your app gets more complex?

Page 56: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

(more events * more objects)(more events * more objects)

Page 57: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Feeling lucky?Feeling lucky?

Page 58: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Tracking Events:Tracking Events:The Challenge The Challenge

How can we minimize the number of objects in play?

How can we minimize the number of events attached and tracked?

Page 59: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

From Attachment to DelegationFrom Attachment to Delegation

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Obj+evnts

Page 60: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

From Attachment to DelegationFrom Attachment to Delegation

Obj Obj Obj Obj

Obj Obj Obj Obj

Obj Obj Obj Obj

Page 61: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

From Attachment to DelegationFrom Attachment to Delegation

Obj Obj Obj Obj

Obj Obj Obj Obj

Obj Obj Obj Obj

Event

Page 62: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

More on “Delegation”More on “Delegation”

Minimize Object and Event Count by:1. Only listen to native

document.onmousedown(or whatever node makes sense)

2. Then determine which event.target (native)

3. Just-in-time handler attachment

Page 63: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Tracking Events:Tracking Events:Event DelegationEvent Delegation

Obj Obj Obj Obj

Obj Obj Obj Obj

Obj Obj Obj Obj

Event

Page 64: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

//listen on parent

YUI.Event.on('parent', 'click', clickDelegate );

function clickDelegate(e){

// get the targetvar origin = YUI.Event.getTarget(e, false);

// delegate “just in time”if(YUI.Dom.hasClass(origin, 'child'))alert(origin.innerHTML + ' was clicked.');

}

<div id="parent"><div class="child">Foo</div><div class="child">Bar</div>

</div>

http://yuiblog.com/sandbox/yui/v0114/examples/event/delegation.php

Page 65: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Tracking Events:Tracking Events:

• Limited objects & simple handlers

• Attachment

• Many objects & multiple handlers

• Delegation

• Many objects & multiple handlers

• Delegation

ApplicationApplicationPagePage

Page 66: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 67: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Memory ManagementMemory Management

Things can get out of hand. Goals:

1) Don’t leak memory2) Keep overall footprint minimal3) Always-responsive, stable

interface

Page 68: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Destructor for each ConstructorDestructor for each Constructor

Thoroughly Unhook and Remove Handlers and References

Page 69: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Three ApproachesThree Approaches

1. DOM Destruction

2. DOM Conservation

3. DOM Recycling

Page 70: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Memory ManagementMemory Management

• Conservation (based on use case)

• Destruction

• Destruction, but also...

• Recycling (of iframes)

ApplicationApplicationPagePage

Page 71: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Memory Management Tip:Memory Management Tip:

Measure and Test– Drip is a great tool

Test:– Extreme object counts

– Long interactions

– Extensive navigation

Page 72: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Drip:Drip:

http://outofhanwell.com/ieleak/index.php?title=Main_Page MSDN: Understanding and Solving Internet Explorer Leak

Patterns

Page 73: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 74: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

General Best PracticeGeneral Best Practice

Single large file is fastest–Avoid HTTP requests

CSS near top JS near </body>

Page 75: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Other Approaches (1):Other Approaches (1):

1) Many small files at once– Enables atomic/team development

– Enables partial caching while other parts change

(build process can clean up and concat.)

Page 76: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Other Approaches (2):Other Approaches (2):

2) Many small files on demand– Tuning in response to use case

analysis

– Overall time faster, individual time slower

(bait and switch)

Page 77: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Other Approaches (3):Other Approaches (3):

3) Inline in the <head>– Caching doesn’t always work.

In particular: browser’s home page.

Page 78: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Delivering CSS and JS:Delivering CSS and JS:

•Many smaller files, on demand. Some inline.

•Every feature not used every time. Content is key.

• Über files of interface JS/CSS. Pay once.

• Then, data and objects on demand

• Single file (anti-example)

• Functionality is key. Highly interconnected.

ApplicationApplicationPagePage

Page 79: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 80: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

General Best PracticeGeneral Best Practice

Use JSON for data interchange–“The fat-free alternative to XML” –Natively understood. No parsing or crawling.

– It’s Ajax not AJAX

http://www.json.org –Tools in every known programming language

Page 81: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Other Approaches:Other Approaches:

Somebody pays to render the View– Pass DOM states as strings

– Important architectural decision

Finding: Parsing XML degrades performance greater-than-linearly as XML size increases.

Page 82: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Data Format:Data Format:

“JSON rocks”

“We want to move to JSON”

“We’re using some JSON, and will be much more soon”

“Recognize strengths of client and server”

ApplicationApplicationPagePage

Page 83: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Disclaimer: JSON is great, but an intimate understanding of your application is best.

Disclaimer: JSON is great, but an intimate understanding of your application is best.

Page 84: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 85: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

could != shouldcould != should

Page 86: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

PaginationPagination

In all cases: – Know your DOM.

– Know your footprint.

– Know your users.

Page 87: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Pagination vs. Endless Scrolling:Pagination vs. Endless Scrolling:

• N/A (single page)

• Some Ajax pagination

• Heavy objects

• Pagination with Ajax (new group in memory)

• Light objects

• Endless-scrolling (and clever caching)

ApplicationApplicationPagePage

Page 88: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Looking Across the SpectrumLooking Across the Spectrum

1. Tracking Events

2. Memory Management

3. Delivering JS and CSS

4. Data Format

5. Pagination

6. Browser Support

Page 89: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Browsers: The Dirty TruthBrowsers: The Dirty Truth

The Web is the most hostile software engineering environment imaginable.

– Douglas Crockford

Page 90: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

BinaryBinary Browser Support Browser Support

Do I need to support Browser XYZ on this project?

Same as saying:

Those users aren’t welcome.

Page 91: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

GradedGraded Browser Support Browser Support

1. “Support” does not mean “Same”

Page 92: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

The Web is Heterogeneous!The Web is Heterogeneous!

“Expecting two users using different browser software to have an identical experience fails to embrace or acknowledge the heterogeneous essence of the Web.”

Page 93: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

GradedGraded Browser Support Browser Support

1. “Support” does not mean “Same”

2. Grades of support provide an [appropriate] experience for all.

Page 94: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

The Web is about The Web is about AvailabilityAvailability

A graded approach is inclusive and brings sanity to QA testing.

Page 95: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]://developer.yahoo.com/yui/articles/gbs/gbs.html

Page 96: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Three Grades of Browser SupportThree Grades of Browser Support

C-grade support (core support, 2%) A-grade support (advanced support,

96%) X-grade support (the X-Factor, 2%)

Page 97: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html

Page 98: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Page 99: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Page 100: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Browser Support:Browser Support:

• GBS A-grade

• Developed in Gecko

• GBS A-grade

• Developed in Gecko

• IE and FF

• Developed in IE, then built IE-emulation layer.

ApplicationApplicationPagePage

Page 101: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Bad decisions are tomorrow’s constraints.

Bad decisions are tomorrow’s constraints.

Page 102: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Bad decisions are tomorrow’s constraints.

Good decisions are tomorrow’s opportunities.

Bad decisions are tomorrow’s constraints.

Good decisions are tomorrow’s opportunities.

Page 103: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

We’re hiring!(Josie Arguada: [email protected])

[email protected]://nate.koechley.com/talks

Page 104: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Questions?Questions?

[email protected]://nate.koechley.com/talks

Page 105: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

I don’t know.I don’t know.

[email protected]://nate.koechley.com/talks

Page 106: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

NamespacesNamespaces

History– JS is load-and-go; text is eval’d; Implied global variables were a

nicety

Bad because of unreliability and insecurity– Trouble when we mashup, have many devs, and programs get

large

Many global variables is bad Ideally, only a single global per app|lib|widget

– An object which contains all others

Speed unaffected; self documentation; reliable Shorten locally if you want. http://yuiblog.com/blog/2006/06/01/global-domination/

Page 107: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Single Page vs. Multiple PageSingle Page vs. Multiple Page

What’s the sweet spot?

Page 108: Nate Koechley – natek@yahoo-inc.com Yahoo! vs. Yahoo!: Case Studies Nate Koechley Senior Engineer & Designer, Yahoo! User Interface (YUI) Library Team

Nate Koechley – [email protected]

Thank you.Thank you.

[email protected]

http://nate.koechley.com/talks

http://developer.yahoo.com/yuihttp://yuiblog.com

http://nate.koechley.com/blog

Photo Credits:– http://www.flickr.com/photos/jacqueline-w/56107224/– http://www.flickr.com/photos/grimreaperwithalawnmower/1918904

28/– http://www.flickr.com/photos/jasonmichael/4126695/