Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Practical Backbone Patterns

Practical Backbone Patterns

In this presentation, I cover a few of the things that I find myself doing over and over again in any Backbone code that I work with.

There are a couple of points I want to stress:

- Sometimes you may not even need a Javascript framework. Maybe just use Javascript and see how far you get without it!

- Lots of small classes that are easily testable make for fun programming

- Avoid single page apps unless you have a good reason too. Can you really justify it? Do your customers care? Zendesk is a good example of a single page app. Its the kind of thing you have open all day. Great use.

- Think about passing a template as an option to the class your building. What if you were responsible for the UI - not it. (check out the autocompletor link below)

- If you need to attach existing behaviour to a page with a Backbone View - checkout the ProxyView (check the link below)

Here are the links to the code I open sourced along with this presentation:

https://github.com/envato/backbone.proxy-view
https://github.com/envato/backbone.autocomplete-view

The presentation git repo is here:

https://github.com/keithpitt/practical-backbone-patterns

E14f55d3f939977cecbf51b64ff6f861?s=128

Keith Pitt

March 13, 2013
Tweet

Transcript

  1. Practical PATTERNS @keithpitt

  2. that I think you may also find useful but I’m

    probably wrong so yeah. I also don’t like the word pattern but couldn’t think of anything else. Also don’t throw things at me because I’m new and nervous. @keithpitt Shit that seems to work for me when I do
  3. None
  4. Desktoppr.co

  5. None
  6. None
  7. None
  8. None
  9. “Backbone App”

  10. Use it as a tool to achieve a certain UI

  11. None
  12. Everything is about Testing.

  13. Single Page Apps #1

  14. Y U NO SINGLE PAGE APP!?

  15. None
  16. File Structure #2

  17. None
  18. None
  19. The Proxy View #3

  20. Dirty

  21. None
  22. None
  23. None
  24. None
  25. None
  26. None
  27. template as an option #4

  28. None
  29. None
  30. Bootstrapping Data #5

  31. None
  32. Don’t use Backbone #6

  33. None
  34. None
  35. None
  36. Page Mediator #7

  37. None
  38. None
  39. THANKS! @keithpitt