Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley...

99
Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley [email protected] [email protected] yuiblog.com developer.yahoo.com/yui nate.koechley.com/blog

Transcript of Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley...

Page 1: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Yahoo! vs. Yahoo!Three Large-Scale Mainstream

DHTML Implementations

Nate [email protected][email protected] • developer.yahoo.com/yui • nate.koechley.com/blog

Page 2: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

a short historical story…

Page 3: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

Page 4: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

Page 5: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

Page 6: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

2000

Page 7: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

2000

2002

Page 8: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

2000

2002

2004

Page 9: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

2000

2002

2004

2005

Source: Comscore, Feb. 2006

Page 10: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1994

1995

1997

2000

2002

2004

2005

2007188mm users /month

5.2billion hits /month

Source: Comscore, Feb. 2006

Page 11: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Video: http://nate.koechley.com/talks/2007/web-design-world/y-vs-y/fp_4.avi

Page 12: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

so what?

Page 13: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

It is immensely telling that the

new Yahoo! homepage is a

DHTML and Ajax

homepage.

Page 14: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

why?

Page 15: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

because of these facts?

Page 16: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

It’s noteworthy because:

1. “Browser are the most hostile software engineering environment possible”

(Douglas Crockford)

Page 17: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

It’s noteworthy because:

1. “Browser are the most hostile software engineering environment possible” (Douglas Crockford)

2. Massive edge-cases and unknowns

Page 18: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

It’s noteworthy because:

1. “Browser are the most hostile software engineering environment possible” (Douglas Crockford)

2. Massive edge-cases and unknowns

3. From content distribution to true software development

Page 19: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

It’s noteworthy because:

1. “Browser are the most hostile software engineering environment possible” (Douglas Crockford)

2. Massive edge-cases and unknowns3. From content distribution to true

software development

4. From Implementation Models to Mental Models

Page 20: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

from implementation model

to mental model

Page 21: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

“Every application must have an inherent amount of irreducible complexity. The only question is who will have to deal with it.”

----Larry Tesler’sLaw of Conservation of Complexity

Page 22: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Which is better?

a) 100 milliseconds?

b) 27 ½ years?

Page 23: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.
Page 24: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

“getting it right the second time”

--matt sweeney

Page 25: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Three Case Studies

Page 26: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

• From Scratch• Massive Scale

– 5.2 billion views/month– 188 million unique users/month

• DHMTL/Ajax Implementation(all data from comScore)

Page 27: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Video: http://nate.koechley.com/talks/2007/web-design-world/y-vs-y/fp_4.avi

Page 28: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

• From Scratch– With legacy constraints

• Massive Scale– 50 million unique users– Open content platform

• Major DHTML/Ajax Implementation

Page 29: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Video: http://nate.koechley.com/talks/2006/12/webbuilder/Yahoo-vs-Yahoo/photos3_2.avi Video: http://nate.koechley.com/talks/2007/web-design-world/y-vs-y/my_1.avi

Page 30: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

• Legacy– For IE via Oddpost in 1999

• Massive Scale– World’s largest email provider ~ 275MM– Available in 21+ languages

• Preeminent DHTML/Ajax Application

Page 31: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Video: http://nate.koechley.com/talks/2007/web-design-world/y-vs-y/mail_3.avi

Page 32: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Common Goals (Technical)

1. Interactivity

Page 33: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

1) Interactivity

• Simple• Efficient• Powerful• Rich• Familiar• Delightful

Page 34: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

“It’s not about what you can do, but how quickly”

-- Steve Carlson,Lead Web Developer, My Yahoo!

Page 35: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Common Goals (Technical)

1. Interactivity2. Performance

Page 36: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

“Law 3: Savings in time feel like simplicity.”

-- John MaedaThe Laws of Simplicity, MIT Press

Page 37: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

2) Performance

• Time ‘til paint• Time ‘til onLoad• Speed over the wire• Speed of development• Resource footprint

Page 38: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Common Goals (Technical)

1. Interactivity2. Performance3. Soundness

Page 39: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

3) Soundness

• True to our beliefs• Stable and foundational• Maintainable• Testable, tunable

Page 40: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Some Common Approaches

YesYesYesCompression

YesNoNoObfuscation

YesYesYesMinimization

YesYesYesKeyboard

NoYesYesFont-size Responsive

YesYesYesCSS Sprites

QuirksStrictStrictRender Mode

NoneHTML 4.01 Strict

HTML 4.01 Strict

Doctype

Page 41: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

toto Applications Applications

from from Documents Documents & Pages& Pages

Page 42: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

The Page—Application Spectrum

• Historically Web• Shallow

Interaction• Simple Idioms• Content-Focused• Markup + Skin• Sequential• Passive

• Historically Desktop• Deep Interaction• Sophisticated

Idioms• Process-Focused• DOM + Ajax• Contained• Active

Page 43: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

ApplicationApplicationPagePage

Page 44: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Pagination6. Browser Support

Page 45: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Browser Support

Page 46: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

From: Page-Granular To: Event-Granular

Page 47: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Use an Event Utility:

• No JS in markup attribute space• Many great utilities

– Dojo– YUI Event Utility– many more…

• Watch out for memory leaks, really

Page 48: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Event 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 49: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

What happens as your app gets more complex?

Page 50: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

more events x more objects

Page 51: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Feeling lucky?Feeling lucky?

Page 52: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Tracking Events: The Challenge

• How can we minimize the number of objects in play?

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

Page 53: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Example: Standard 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 54: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Example: Single Delegating Event

Obj Obj Obj Obj

Obj Obj Obj Obj

Obj Obj Obj Obj

Event

Page 55: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Minimize object and event counts:

1. Capture the element high in the DOM tree: document.onclick

2. Then determine which element getTarget()

3. Then add just-in-time logic

Example:http://yuiblog.com/sandbox/yui/v0114/examples/event/

delegation.php

Page 56: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.
Page 57: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Tracking Events:

• Limited objects & simple handlers• Attachment

• Event Delegation Plan• Event Model API divorced from UI

• Many objects & multiple handlers• Event Delegation Plan

ApplicationApplicationPagePage

Page 58: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Browser Support

Page 59: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Memory Management

Things can get out of hand.Things will get out of hand.

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

interface

Page 60: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

The Key Approach

1.DOM Destruction• Thoroughly Unhook and

Remove Handlers and References

• YUI Event provides lots for free

Page 61: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Two Approaches

1.DOM Preservation2.DOM Recycling

Page 62: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Memory Management Tip (1)

Monitor Usage

• Drip is a great tool on PC– MSDN: Understanding and Solving

Internet Explorer Leak Patterns– http://outofhanwell.com/ieleak/

index.php?title=Main_Page

Page 63: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Memory Management Tip (2)

Monitor Various Usage Cases1. Extreme object counts2. Long interactions3. Extensive navigation

Page 64: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Memory Management

• Preservation (based on use case)

• Destruction

• Destruction, but also...• Recycling (of iframes)

ApplicationApplicationPagePage

Page 65: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Browser Support

Page 66: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

General Best Practice:

Single large file is fastest

•Minimize HTTP requests– http://yuiblog.com/blog/

2006/11/28/performance-research-part-1/

•CSS near top•JS near </body>

Page 67: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Another Approach (1)

Many small files at once

• Enables– team development– atomic testing– partial caching

• A build process can clean up and concatenate for production

Page 68: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Another Approach (2)

Many small files on demand• Enables

– easier tuning in response to real-world usage

– Faster overall time, though sometimes slower individual time

(bait and switch)

Page 69: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Another Approach (3)

Inline in the <head>

• Caching doesn’t always work.– In particular: browser’s home

page.

• DNS lookups are costly• Extra domains are costly

Page 70: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

71Yahoo! ConfidentialNate Koechley – [email protected]

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 71: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Browser Support

Page 72: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

General Best Practice (1)

• 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 73: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

General Best Practice (2)

• Track and create “state” on the server.

• My Y!:– Pass generated HTML in set JSON

wrapper– Set JSON structure includes content,

metadata, and assets

Page 74: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Other Notes:

• Who’s CPU to heat up is an important architectural question.

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

Page 75: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

76Yahoo! ConfidentialNate Koechley – [email protected]

Data Format:

“JSON rocks”

JSON, DOM strings

“Some JSON, and more soon”“Be sure to recognize strengths of client and server”

ApplicationApplicationPagePage

Page 76: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

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

Page 77: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Looking Across the Spectrum

1. Tracking Events2. Memory Management3. Delivering JS and CSS4. Data Format5. Browser Support

Page 78: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Binary Browser Support

•Do I need to support Browser Foo on this project?

Same as saying:Those users aren’t welcome.

Page 79: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Graded Browser Support

1.“Support” does not mean “Same”

Page 80: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

same isn’t important

“Expecting identical experiences fails to embrace or acknowledge the heterogeneous essence of the Web.”

Page 81: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Graded Browser Support

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

Page 82: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

The Web is about Availability

A graded approach welcomes everyone while bringing sanity to development and testing.

Page 83: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Browsers: The Dirty Truth

•The Web is the most hostile software engineering environment imaginable.

– Douglas Crockford

Page 84: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

http://developer.yahoo.com/yui/articles/gbs/

Page 85: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

C-grade - core support, ~ 2%

A-grade - advanced support, ~ 96%

X-grade - the X-Factor, ~ 2%

Three Grades of Browser Support

Page 86: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

http://developer.yahoo.com/yui/articles/gbs/

Page 87: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.
Page 88: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.
Page 89: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

90Yahoo! ConfidentialNate Koechley – [email protected]

Browser Support:

• GBS A-grade• Developed with Web Standards

• GBS A-grade• Developed with Web Standards

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

ApplicationApplicationPagePage

Page 90: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Cheat Sheet:

1. Stay true to your beliefs2. Have an event plan3. Monitor memory and CPU4. Minimize HTTP requests5. Create state on server6. Have a sane browser support

plan

Page 91: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Bad decisions are tomorrow’s constraints.

Page 92: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Bad decisions are tomorrow’s constraints.

Good decisions are tomorrow’s opportunities.

Page 93: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Thank you.

Page 94: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

We’re Hiring!

Josie Aguada: [email protected]

Usual suspects:

JavaScript, PHP, CSS, HTML, ActionScript…

Page 95: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Thank you.

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

• http://developer.yahoo.com/yui• http://yuiblog.com• http://nate.koechley.com/blog

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

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

Page 96: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

[email protected]

Questions?

Page 97: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

i don’t know.

Page 98: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Namespaces

• 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 99: Yahoo! vs. Yahoo! Three Large-Scale Mainstream DHTML Implementations Nate Koechley natek@yahoo-inc.com natek@yahoo-inc.com nate@koechley.com nate@koechley.com.

Single Page vs. Multiple Page

• What’s the sweet spot?