Title: Y! v. Y! Yahoo! Case Studies Across the Page
1Y! v. Y! Yahoo! Case Studies Across the
PageApp Spectrum, One Size Does Not Fit All
Nate Koechley _at_Media 2006, London June 16th,
2006 nate_at_koechley.com http//nate.koechley.com/
blog
2Y! v. Y! v. Y! Three Yahoo! Case Studies
Across the PageApp Spectrum, One Size Does
Not Fit All
Nate Koechley _at_Media 2006, London June 16th,
2006 nate_at_koechley.com http//nate.koechley.com/
blog
3Nate Koechley
4Its Pronounced Keklee
5Hello, World
- Nate Koechley
- At Yahoo! since 2001
- Charter member of Web Development team
- On Yahoo! User Interface Library (YUI) team
- Three roles
- Senior Frontend Engineer
- Technical Evangelist
- Design Liaison
6Yahoo! User Interface Library (uh, thanks Simon)
- A la carte
- Event 2k
- onAvailable
- Custom Events / Pub-Sub
- DOM 3k
- Add/replace Class
- Utilities vs. Controls, also CSS
- Theres no shortage of better things to spend
time on.
7The DHTML Universeby Dojos Alex Russell (work
in progress)
http//alex.dojotoolkit.org/DHTML_universe.pdf
812345678
912345678
1012345678
1112345678
1212345678
1312345678
1412345678
1512345678
16A Great Community at Yahoo!
17Praise Them, Blame Me
18You?
19OK then, a quick history
20A bit of evolution over the years
1994
21A bit of evolution over the years
1994
1995
22A bit of evolution over the years
1994
1995
1997
23A bit of evolution over the years
1994
1995
1997
2000
24A bit of evolution over the years
1994
1995
1997
2000
2002
25A bit of evolution over the years
1994
1995
1997
2000
2002
2004
26A bit of evolution over the years
1994
1995
1997
2000
2002
2004
into the page that today welcomes 188m users
every month, 5.2 billion times
Source Comscore, Feb. 2006
27The New Yahoo! Home Page
Video http//nate.koechley.com/talks/20060616_atm
edia/fp_2.avi
28It is immensely telling that the new Yahoo!
homepage is a DHTML homepage.
29Getting It Right The Second Time
30Three Case Studies
31Case Study 1
- History
- Preview release exactly one month ago today
- From scratch
- Newest development effort to be released
- Massive Scale
- 5.2 billion views per month
- 188 million unique users
- Major DHMTL and Ajax Implementation
32Case Study 1Yahoo! Home Page Preview
Video http//nate.koechley.com/talks/20060616_atm
edia/fp_2.avi
33Case Study 2
- History
- Beta release exactly eight days ago
- From scratch
- Long development timeline
- Massive Scale
- 30 million unique users
- 2 billion photos
- Major DHTML and Ajax Implementation
34Case Study 2Yahoo! Photos Beta
Video http//nate.koechley.com/talks/20060616_atm
edia/photos3_2.avi
35Case Study 3
- History
- Beta release about one year ago
- Legacy-ish, was Oddpost.com
- Oddpost development began in 1999
- Massive Scale
- Worlds largest email provider
- Available in 21 languages
- Preeminent DHTML and Ajax Application
36Case Study 3Yahoo! Mail Beta
Video http//nate.koechley.com/talks/20060616_atm
edia/mail_1.avi
37do not worry not a product pitch
38Common Goals
39Common Goals1) Performance (x3)
40Common Goals1) Performance 2) Interactivity
41Common Goals1) Performance 2)
Interactivity3) Stay true to our beliefs
42Common Approaches
43The Basics
None
XHTML 1.0 Strict
HTML 4.01 Strict
Doctype
Quirks
Strict
Strict
Render Mode
Yes
Yes
Yes
CSS Sprites
No
Yes
Yes
Font-size Responsive
Yes
Yes
Yes
Keyboard
No
No
No
Absolute Pos
Yes
Yes
Yes
Minimization
Yes
No
No
Obfuscation
Yes
Yes
Yes
Compression
44From Documents to Applications
45PageApplication Spectrum
- Historically Web
- Shallow Interaction
- Simple Idioms
- For Consumption
- Markup Skin
- Sequential Nav
- Passive
- Historically Desktop
- Deep Interaction
- Powerful Idioms
- For Productivity
- JS, DHTML, Ajax, DOM
- Self Contained
- Active
46PageApplication Spectrum
47Looking Across the Spectrum
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
48Looking Across the SpectrumTracking Events
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
49From Page-Granular to Event-Granular Interfaces
50Tracking EventsEvent Utilities
- Dont piss off the DOM Scripting Task Force
- No JS in attribute space / markup!
- Watch out for memory leaks!!! (yes, three !s)
- Many great utilities
- YUI Event Utility
- Dojo
- Scott Andrew
- many more
51Tracking EventsEvent 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
52Browsers die when there are too many (objects
listeners)
53Tracking EventsLots and lots
- Objects can have many events
- Multiple keyboard listeners
- Downdrag
- Downkey
- Downdoubleclick
- Downclickkey
- More
- Multiple by countless number of objects!
54Tracking EventsEvent 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
55Tracking EventsEvent Delegation
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
56Tracking EventsEvent Delegation
Event
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
57More on Delegation
- Addressing Object Count
- Listen to document.onmousedown (native)
- Note which event.target (native)
- Addressing Handler Count
- Then delegate and attach the handlers you need,
just in time.
58Event Delegation Example
- Mousedown in vicinity of thumbnail
- If on ltimggt
- If MouseMove
- Assign Drag and Drop
- If on whitespace
- If MouseMove
- Assign Selection Rectangle
59Event Delegation Example
- Is the click on a photo thumbnail?
- If so, delegate to its related Javascript
controller object eg photoItemsthis.index.mous
edown() - Where "this" is the thumbnail ltimggt clicked, via
event.target/srcElement etc.
60Tracking EventsEvent Delegation
Event
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
Obj
61Tracking EventsDetails
- Few Objects with Simple Handlers
- Event Attachment
- Many Objects w/ Multiple Handlers
- Event Delegation
- Many Objects w/ Multiple Handlers
- Event Delegation
62Looking Across the SpectrumMemory Management
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
63Memory Management
- With extensive DOM and JS work, theres the
potential for things to get out of hand. - Goals
- Dont leak memory
- Also, keep overall memory footprint small
- Offer a quickly-responsive interface
- Stability
64Memory ManagementGeneral Best Practices
- For each constructor have a destructor
- Create Objects
- Unhook
- Remove Handlers
- Remove References
65Memory ManagementThree Approaches
- Destruction (general best practice)
- Conservation (niche)
- Recycling (niche)
66Memory ManagementDetails
- Destruction, but
- Recycle iframes (aboutblank)
67Memory Management Tip
- Measure and Test
- Drip is a great tool
- Test extreme object counts
- Test long interactions
- Test extensive navigation
68Looking Across the SpectrumDelivering JS and CSS
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
69Delivering JS and CSSGeneral Best Practices
- A single large file loads fastest.
- HTTP requests are the nemesis of a well-tuned
site. - Build process is, therefore, very important.
- CSS files as close to the top as possible.
- JS files as close to lt/bodygt as possible.
70Delivering JS and CSSThree Other Approaches
- 1) Many small files at once
- Enables atomic/team development
- Enables partial caching if parts change
71Delivering JS and CSSThree Other Approaches
- 2) Many small files on demand
- Some demanded functionality may be subtly slower
- Allows tuning in response to use cases and task
analysis
72Delivering JS and CSSThree Other Approaches
- 3) Inline in the ltheadgt
- Caching is not as effective as we imagine,
especially on pages set as browser home pages
73Delivering CSS and JSDetails
- Many smaller files, on demand. Some inline.
- Every feature not used every time. Content is key.
- Uber file of interface JS/CSS. Pay once.
- Objects/data on demand
- Single File (anti-example)
- Functionality is key. Highly interconnected.
74Looking Across the SpectrumData Format
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
75Data FormatGeneral Best Practice
- Use JSON for data interchange
- Natively understood
- The fat-free alternative to XML
- http//www.json.org
- Tools in every known programming language
76Data FormatOther Approaches
- Somebody is going to have to pay the CPU price to
render the View - Faster to pass a string that expresses a DOM
state directly than trying to parse and create on
the fly. - Consider client and server in tandem when making
architectural choices - Parsing XML degrades performance
greater-than-linearly as XML size increases.
77Data FormatDetails
JSON rocks
We want to move to JSON
Were using some JSON, and will be much more
soon Recognize strengths of client and server
78Looking Across the SpectrumPagination
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
79Ajax is awesome!! Hmmm, I know we can do
pagination without refreshing the page!! Sweet,
were so totally Web 2.0 now!!
80Could does not equal should.
81PaginationDetails
- Single page, so basically not applicable.
- Some Ajax pagination in Personal Assistant module
- Heavy Objects
- Ajax Pagination No refresh but new collection.
- Light Objects
- Endless-scrolling (and clever caching)
82Looking Across the SpectrumBrowser Support
- Tracking Events
- Memory Management
- Delivering JS and CSS
- Data Format
- Pagination
- Browser Support
83Which browser to support?
84http//developer.yahoo.com/yui/articles/gbs/gbs.ht
ml
85Graded Browser SupportTwo Key Ideas
- 1) Support does not mean the same
- Expecting two users using different browser
software to have an identical experience fails to
embrace or acknowledge the heterogeneous essence
of the Web. - 2) Support must not be binary!
86Graded Browser SupportGeneral Best Practice
- 3 Grades of Browser Support
- C-grade support (core support, 2)
- A-grade support (advanced support, 97)
- X-grade support (the X-Factor, 1)
87http//developer.yahoo.com/yui/articles/gbs/gbs.ht
ml
88A bit about browser stats
89A bit about browser stats
- More 5.0 than 5.5
- We consider 5.0 C-Grade
- Note by-country skews
- Note by-content skews
- IE7 already moved the needle
- Historically, SP2 rollout out very quickly
90Browser as Development Environment?
91Browser SupportSummary
- Still a huge pain in the ass.
- The Web is the most hostile software engineering
environment imaginable. - (Douglas Crockford)
- Same answer for everybody.
- Develop to standards, then patch.
- Maintain discipline in the face of heterogeneity.
92The price is always higher to say no to Safari
and Opera
93Browser SupportDetails
- GBS A-grade
- Developed in Gecko
- GBS A-grade
- Developed in Gecko
- IE and FF
- Developed in IE, then built IE-emulation layer.
94We're in this for the long haul.
95Quality is OUR job. Be belligerent.
96Todays bad decisions will be tomorrows
constraints
97Thank you. Questions?
- Nate Koechley
- natek_at_yahoo-inc.com
- http//developer.yahoo.com/yui
- http//yuiblog.com
- nate_at_koechley.com
- http//nate.koechley.com/blog
- This presentation is available at
http//nate.koechley.com/talks/20060616_atmedia/at
media2006.ppt http//nate.koechley.com/talks/20060
616_atmedia/atmedia2006.pdf