More base2.DOM and advice for writing JavaScript libraries
Written by on March 26th, 2007 in Ajax News.
Dean Edwards has followed up on his base2 library posting with another way to use base2 and rules for JavaScript Library Authors.
In “the other way” Dean shows how to use the library as library functions instead of strapping on to objects, and his library rules are:
- Be unobtrusive
- Object.prototype is verboten!
- Do Not Over-extend
- Follow Standards
- Or Follow The Leader (Mozilla)
- Be Flexible
- Manage Memory
- Eliminate Browser Sniffing
- Small is Better
- The Tenth Rule: Be Predictable
- Bonus Rules: Documentation. Annoying but true., The more namespacing you use, the less likely I am to remember your phone number., Remember that potentially millions of people will be executing your code.
This is good advice whether you are writing the next Dojo, or working on your own project too. Code bases get bigger, and you don’t want to clash with your own code.
Source: Ajaxian
Original Article: http://ajaxian.com/archives/more-base2dom-and-advice-for-writing-javascript-libraries