I just finished reading Boydlee and Trevor‘s new (e)book: Appcelerator Titanium: Patterns and Best Practices.
Want to learn the best practices from Boydlee in person? He will be speaking at the Amsterdam Titanium meetup on April 15th.
This is my take from it:
- Always place the opening curly bracket on the same line.
forwherever you can.
var ln;before using
ln = Array.lengthin
forso the calculation is cached.
- Use the code formatter in Titanium Studio: Source / Format or Shift-Command-F.
- Enable JSLint validation in Titanium Studio (3.1): Preferences > Studio > Validation > JSLint Validator.
- Always at least
- Never use anonymous functions as event listeners, since you cannot remove them.
- Null heavy objects like WebViews and Maps when closing a window to speed up memory release.
- Re-read the docs on platform-specific resources.
- Prevent recursive
requireby using callbacks instead.
- Always use