Over past 18 month, I have been building backbone application. During this period I have learn a lot about backbone and best practices.
Here I compiled my learning.
- Backbone is un-opiniated lib, so build your application as best suited for you.
- Do not operate on DOM directly. Backbone has its own DOM element "el".
- Do not store data in DOM or view.
- Do not operate on view directly for DOM interaction, change state of backbone model, and let backbone view respond to state change.
- Events are good, use backbone event whenever possible.
- Use pub-sub system to interact on multiple view.
- Unwind event listener when view is removed.
- Use view level jquery el $.