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.
Posted by Dion Almaer at 9:04 am