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

Keith Pitt

March 13, 2013
Tweet

More Decks by Keith Pitt

Other Decks in Programming

Transcript

  1. Practical
    PATTERNS
    @keithpitt

    View full-size slide

  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

    View full-size slide

  3. Desktoppr.co

    View full-size slide

  4. “Backbone App”

    View full-size slide

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

    View full-size slide

  6. Everything is about
    Testing.

    View full-size slide

  7. Single Page Apps
    #1

    View full-size slide

  8. Y U NO SINGLE
    PAGE APP!?

    View full-size slide

  9. File Structure
    #2

    View full-size slide

  10. The Proxy View
    #3

    View full-size slide

  11. template as an
    option
    #4

    View full-size slide

  12. Bootstrapping Data
    #5

    View full-size slide

  13. Don’t use Backbone
    #6

    View full-size slide

  14. Page Mediator
    #7

    View full-size slide

  15. THANKS!
    @keithpitt

    View full-size slide