Using the Yahoo Global Object to Manage Object Inheritance and Composition: Four New YUI Examples
November 6, 2007 at 5:54 pm by Eric Miraglia | In Development |
This morning we posted four new examples that step through some of the most important methods in the YUI Library — particularly YAHOO.lang.extend, YAHOO.lang.augmentObject, and YAHOO.lang.augmentProto. These methods are used internally in the library to manage inheritance and composition, and we think you’ll find them useful in your own code, too. This is also a good excuse to introduce you to Luke Smith (pictured), the newest member of the YUI engineering team and the author of this new example set.
- Creating Class Hierarchies with
YAHOO.lang.extend— explores the use ofYAHOO.lang.extendto build traditional class-style hierarchies in JavaScript; - Creating a Composition-Based Class Structure Using
YAHOO.lang.augmentProto— as Luke puts it, "the intent of augmentProto is to aid in extracting nonessential behaviors or behaviors shared by many classes, allowing for a composition-style class architecture"; in this example, he shows you how to do that by applying the YUI Event Utility’sEventProviderfunctionality usingaugmentProto; - Add Behavior to Objects or Static Classes with
YAHOO.lang.augmentObject—augmentObjectprovides functionality similar to that ofaugmentProto, but is designed for work with static classes where you want to confine your augmentation to the target object (rather than its prototype); - Combining Simple Data Sets with
YAHOO.lang.merge— in a different category,YAHOO.lang.mergeallows you to combine two objects together, outputting a third (new) object.
Any questions for Luke on these? Post them here, or jump over to the YUI developer forum and start a thread there.
Share and extend: Bookmark with Yahoo! My Web | Bookmark with del.icio.us | digg it! | reddit!
1 Comment »
RSS feed for comments on this post. TrackBack URI
Leave a comment

Copyright © 2007 Yahoo! Inc. All rights reserved. Privacy Policy - Terms of Service
Powered by WordPress on Yahoo! Web Hosting.
[…] Yahoo! UI team have “posted four new examples that step through some of the most important methods in the YUI Library — particularly YAHOO.lang.extend, YAHOO.lang.augmentObject, and YAHOO.lang.augmentProto. These […]
Pingback by Ajaxian » Using the Yahoo Global Object to Manage Object Inheritance and Composition — November 15, 2007 #