YUI The Elephant In The Room

10,555 views

Published on

Nate Koechley and Chris Heilmann's YUI presentation on Open Hack Day London 2007

Published in: Technology
  • Be the first to comment

YUI The Elephant In The Room

  1. YUI – The Elephant in the room Christian Heilmann and Nate Koechley UK Open Hack Day – London – 16 th June 2007 [email_address] & [email_address] & creative commons by: 3.0
  2. <ul><li>Following is a transcript of a chat I had a week before I joined Yahoo! a bit over a year ago. </li></ul><ul><li>I had just finished writing my book on JavaScript. </li></ul>
  3. <ul><li>[chris] Hey, I took the job at Yahoo in London! </li></ul><ul><li>[friend] Congrats, so much for you coding. I guess now it is all YUI for you. </li></ul><ul><li>[chris] Nah, I honestly haven’t done much with it, but what I saw seems a bit bloated, I guess for most of the stuff I will code my own scripts. It is an OK library, but I am not convinced. </li></ul>
  4. <ul><li>Now I am standing here, talking to you about the YUI and why it is a good thing. </li></ul><ul><li>What happened? </li></ul>
  5. To: Mechanical Turk Subject: I can has beat-up for Chris?
  6. To: Mechanical Turk Subject: I can has beat-up for Chris?
  7.  
  8.  
  9. <ul><li>Pragmatism </li></ul>
  10. <ul><li>Let me show you some of the things I spend money on… </li></ul>
  11.  
  12. <ul><li>This is our third Henry, … the first … lasted five years, the only reason it went was because it was used and abused but still worked. The second lasted about ten years went for the same reason as the first. </li></ul><ul><li>Our last Henry was a bit of a disappointment it blew up after fifteen years but we have still purchased another one. </li></ul>
  13.  
  14. <ul><li>Air cushioned </li></ul><ul><li>Resistant to </li></ul><ul><ul><li>Oil </li></ul></ul><ul><ul><li>Fat </li></ul></ul><ul><ul><li>Acid </li></ul></ul><ul><ul><li>Petrol </li></ul></ul><ul><ul><li>Alkali </li></ul></ul><ul><li>Steel Toes </li></ul><ul><ul><li>Perfect to wear on the tube </li></ul></ul>
  15. <ul><li>And this is what the YUI is. </li></ul><ul><ul><li>Industrial-strength solutions for every day problems </li></ul></ul><ul><ul><li>If it works for our web sites it should work for you (or do you have more users?). </li></ul></ul>
  16. <ul><li>Using the YUI also means another, very important step towards producing big products. </li></ul><ul><ul><li>It takes the random element out of web development. </li></ul></ul><ul><li>Normally we have the following scenario: </li></ul>
  17. HKR 1 Prod 1 <ul><li>Own conventions </li></ul><ul><li>Own testing methods </li></ul><ul><li>Own environment </li></ul><ul><li>Own coding style </li></ul><ul><li>Own sense of who uses the product </li></ul>
  18. HKR 2 Prod 1 <ul><li>Own conventions </li></ul><ul><li>Own testing methods </li></ul><ul><li>Own environment </li></ul><ul><li>Own coding style </li></ul><ul><li>Own sense of who uses the product </li></ul>
  19. HKR 3 Prod 1 <ul><li>Own conventions </li></ul><ul><li>Own testing methods </li></ul><ul><li>Own environment </li></ul><ul><li>Own coding style </li></ul><ul><li>Own sense of who uses the product </li></ul>
  20. Prod 1
  21. HKR 2 Prod 1 HKR 3 HKR 1 YUI Magic!
  22. <ul><li>YUI allows simple collaboration by enforcing a strict namespace. </li></ul><ul><li>This is what I considered “bloated” until I realized the benefits of it. </li></ul><ul><li>Namespacing of the different YUI components and clever namespacing of your objects ensures readability. </li></ul>
  23. <ul><ul><li>YAHOO.util.Dom.addClass </li></ul></ul><ul><ul><li>YAHOO.util.Event.getTarget </li></ul></ul><ul><ul><li>YAHOO.widget.Tooltip </li></ul></ul><ul><ul><li>YAHOO.util.DragDrop </li></ul></ul><ul><ul><li>YAHOO.util.Connect.isCallInProgress </li></ul></ul><ul><li>All do what they say on the tin. </li></ul>
  24. <ul><li>By coming up with your own namespace and sticking to it, you ensure that your code will play well with others. </li></ul><ul><li>You can cut your applications up into several components and develop them in parallel without interfering. </li></ul><ul><li>File size of your scripts can be easily reduced by minifying and gzipping the scripts – long names pack nicely. </li></ul>
  25. <ul><li>The best thing: </li></ul><ul><ul><li>Readable method names = half a good comment </li></ul></ul><ul><ul><li>Agreed namespace = understanding what your predecessors have done. </li></ul></ul>
  26. <ul><li>The next best thing: </li></ul><ul><ul><li>Submitted hacks should either use a BBC or a Yahoo! API. </li></ul></ul>
  27. <ul><li>The next best thing: </li></ul><ul><ul><li>Submitted hacks should either use a BBC or a Yahoo! API. </li></ul></ul><ul><ul><li>yahoo-min.js is 1kb , gives you the namespace and satisfies this rule :-) </li></ul></ul>
  28. HKR 1 Prod 1
  29. HKR 1 Prod 1 The INTERNETS
  30. HKR 1 Prod 1 The INTERNETS DA DAH DUUUUUMMMM…
  31. <ul><li>The INTERNETS are scary, as they mean: </li></ul><ul><ul><li>Different Browsers </li></ul></ul><ul><ul><li>Different Assistive Technology </li></ul></ul><ul><ul><li>Different Operating Systems </li></ul></ul><ul><ul><li>Different Configurations </li></ul></ul><ul><ul><li>Different Hardware </li></ul></ul>
  32. HKR 1 Prod 1 The INTERNETS 20% 80%
  33. HKR 1 Prod 1 HKR 3 HKR 2 HKR 4 HKR 5
  34. HKR 1 Prod 1 Secret YUI lair! HKR 3 HKR 2 HKR 4 HKR 5
  35. HKR 1 Prod 1 Secret YUI lair! HKR 3 HKR 2 HKR 4 HKR 5 Battle And Tame The Internets!
  36. HKR 1 Secret YUI lair! HKR 3 HKR 2 HKR 4 HKR 5 HKR Several hundreds in world-wide locations X
  37. <ul><li>And now we need you to help us make this even better. </li></ul>
  38. <ul><li>Photo Credits </li></ul><ul><ul><li>Numatic Henry http://www.flickr.com/photos/nicohogg/516490143/ </li></ul></ul><ul><ul><li>Docs http://www.flickr.com/photos/davetron5000/276535342/ </li></ul></ul><ul><ul><li>Elephant http://www.flickr.com/photos/euromagic/318774561/ </li></ul></ul><ul><ul><li>Vic20 Game http://www.flickr.com/photos/lifeontheedge/84913291/ </li></ul></ul><ul><ul><li>Chris and the babes: http://www.flickr.com/photos/72169999@N00/348839862/ </li></ul></ul><ul><ul><li>Nate http://www.flickr.com/photos/freshelectrons/400135496/ </li></ul></ul><ul><ul><li>Spaghetti http://www.flickr.com/photos/hikikomori/155256307/ </li></ul></ul><ul><ul><li>Kitten http://www.flickr.com/photos/miller-lowe/346191736/ </li></ul></ul><ul><ul><li>Puppy http://www.cuteoverload.com </li></ul></ul>
  39. YUI Goodies Industrial strength cross-browser JavaScript and CSS, free for all
  40. The YUI Team
  41. <ul><li>“ You bring the skills. We bring the ingredients.” </li></ul>
  42. What’s YUI got?
  43. [primitives] [compounds] [idioms] Connection Manager (Ajax) Event Utility Dom Collection Drag & Drop Animation CSS Reset, Fonts, Grids The Yahoo! User Interface Library Logger Control Menu Control Slider Tree Control Calendar Control AutoComplete DHTML Windowing TabView
  44. DOM Utility <ul><li>Positioning HTML Elements </li></ul><ul><li>Get/set Styles </li></ul><ul><li>Client/Viewport/Doc Size </li></ul><ul><li>Manage Class Names </li></ul><ul><li>Regions & points </li></ul>
  45. Event Utility <ul><li>Attach to one or many </li></ul><ul><li>Auto-deferral if nodes aren’t yet available; execute onAvailable </li></ul><ul><li>Auto scope correction (or assign) </li></ul><ul><li>Can send objects </li></ul><ul><li>Automatic listener cleanup </li></ul><ul><li>Custom Events (pub/sub) </li></ul>
  46. Animation <ul><li>Beautiful API </li></ul><ul><li>Size/opacity/color/position/etc </li></ul><ul><li>Bezier math </li></ul>
  47. Good for spicing up hacks: <ul><li>Slider </li></ul><ul><li>AutoComplete </li></ul><ul><li>DragDrop </li></ul><ul><li>Menu / Tabs / Trees </li></ul><ul><li>Container </li></ul><ul><li>Reset / Fonts / Grids </li></ul>
  48. But wait, there’s more!
  49. Design Patterns
  50. Design Patterns
  51. What happens when the mouse is pressed on the draggable object but dragging has not initiated? Storyboard Template for Drag & Drop
  52. A full pantry <ul><li>web services & data </li></ul><ul><li>+ YUI (interface code) </li></ul><ul><li>+ Y design patterns </li></ul><ul><li>-------------------- </li></ul><ul><li>= tasty hack goodness </li></ul>
  53. Getting Started
  54. Wide-open BSD License
  55. Free hardcore hosting <ul><li>http://yui.yahooapis.com/2.2.2/build/dom/dom-min.js </li></ul><ul><li>http://yui.yahooapis.com/2.2.2/build/event/event-min.js </li></ul><ul><li>http://yui.yahooapis.com/2.2.2/build/utilities/utilities.js </li></ul><ul><li>http://yui.yahooapis.com/2.2.2/build/reset-fonts-grids/reset-fonts-grids.css </li></ul>
  56.  
  57. Three Versions of each File <ul><li>http://yuiblog.com/blog/2006/10/16/pageweight-yui0114/ </li></ul>
  58. À la carte Dependencies
  59.  
  60. Download full dist with all docs & examples <ul><li>http://developer.yahoo.com/yui/download/ </li></ul>
  61. Landing Page Quick Start Guides
  62. Complete API Documentation
  63. Examples and Tutorials
  64. The YUI Cheat Sheets
  65. ydn-javascript list
  66. YUI Logger and Firebug <ul><li>alert(“stop the insanity”); </li></ul><ul><li>YAHOO.log(“There IS a better way”); </li></ul><ul><li>Debug with Logger or Firebug directly. </li></ul>
  67. Things we’re proud of: <ul><li>Good page citizens </li></ul><ul><li>We like javascript </li></ul><ul><li>We care about accessibility and browser support </li></ul>
  68. Graded Browser Support
  69. Senior Architectural Leadership <ul><li>Douglas Crockford: </li></ul><ul><ul><li>“ Yoda of lambda programming and JavaScript” according to Brendan Eich (Inventor of JavaScript) </li></ul></ul><ul><li>Rasmus Lerdorf </li></ul><ul><ul><li>Father of PHP </li></ul></ul>
  70. Now Hack! And come find me anytime.

×