Housekeeping Thank The underground Thank Kyle for organizing/inviting me Ask people checking twitter to move to the back (I won’t if you don’t) Ask questions if you want, may stop answering if I fall behind
Green pants are a WC thing
Contributor to Marionette
What am I going to be talking about? Expect about 20 minutes of me talking, 20 minutes of demos, and then plenty of time for questions
This description is from the Backbone website
Backbone is foundational only. Nothing gets included that everyone won’t use. Obviously everybody doesn’t use the exact backbone code, but conceptually everybody has to have something like whats included in Backbone
Backbone provides 5 simple concepts. That’s it!
Single unit of data, roughly corresponds to a resource in a REST API, a database table, or a Class on the backend
Blog => Post Comment
Admin => Users Anything that you can have many of
Above and beyond a normal object, Models provide easy persistence to the server, events that let you watch it for changes, and helper functions for common object operations
List of models
Like models, they handle persistence and add lots of helper functions and events
Views are the most minimal part of Backbone
They set up a framework for displaying content based on data, but don’t force you to do it in a particular way
Not everyone needs a router If you have a server driven app, you can probably ignore this
But if you’re building an SPA, this is the way to do it with Backbone
Events are how Backbone objects coordinate with each other
Views can listen to events on models, models can listen to events on sub models or collections, and you can define custom objects to trigger events and act as a message bus between parts of your app
So its small, simple, and its been around for a while. Why should **I** care about Backbone?
First its always nice to see some credibility.
Lots of big name companies are “still” using Backbone. You can see there are a good mix of use-cases as well. Plenty of content companies, some music companies, some ecommerce, productivity, really all over the map.
Is newer always better here? Have we just found definitively better ways of doing things?
I’ve seen a lot of talks like this, focused on a framework, and I know there’s a protocol I’m supposed to follow.
I’m supposed to talk about my framework “journey” and how my life has slowly gotten better as I started using jQuery, then moved onto other frameworks , and finally got to REALLY COOL FRAMEWORK X. It usually looks something like this
So there are an incredible amount of developers out there getting by just fine without any fancy frameworks. Who are hanging out on the first phase of that evolutionary ladder. And sure some of them are just using the only thing they know. But many are finding jQuery to be the right solution to their problem. What can we learn from that?
How you feel about this can lead to 2 responses.
If you think Frameworks are constantly evolving along a track to becoming better and better, you might dismiss it and say you need the new thing
If you don’t see the point of all the added code and complexity frameworks bring you might question whether you need a framework altogether
I prefer to think about JS frameworks the same way I think of programming languages on the backend. Some may be better, some worse, but the important ones all have a few central ideas that they bring to the table that can make you a better programmer, both when you’re using them or other frameworks
This is where Backbone most differs from Ember/Angular/React. For the most part its not trying to solve problems for you, it tries to provide an environment for you to solve problems
well over half of the backbone case is jQuery
The best thing about this is that the ecosystem embraces these traits
You look at its track record. How has it handled the change around it over time?
I want to show you what it might have looked like to write a Backbone App in 2010 and maintain it through today
So we are going to write a blog commenting system
iPad was released We were still in a recession Duke won a national championship
Show the simple Demo + App.js
No magic You can use some of it or all of it Adds more to Backbone but stays minimalist
Marionette helps give your application structure and provides much richer defaults and helpers for your View code
Note that we didn’t have to change any model code to do this
So the site was great. But now its 2013, and we don’t want to have to refresh the page to see what other people are saying as they comment
View code doesn’t have to change at all
Make sure to demo the fact that an update overwrites the comment in progress.
View code doesn’t have to change at all
Why Listen To Me?
• Front-End Developer @ Windsor Circle
• Over a year working with Backbone
• Plenty of experience with alternatives: React,
Angular, Knockout, plain jQuery
What To Expect
• What is Backbone?
• Why is it (still) relevant?
• Cool demos
• Written in 2010 by Jeremy Ashkenas
• Currently at version 1.1.2 and essentially “stable”
• Dependencies: jQuery + Underscore (or
“Philosophically, Backbone is an attempt to
discover the minimal set of data-structuring
(models and collections) and user interface
(views and URLs) primitives that are generally
useful when building web applications with
“Anything you will always need for building a
front-end web application should be in
Backbone. Everything else should not be”
2 Responses To Backbone
• “Backbone is much too basic. I need a tool that
does more for me, like Angular, Ember or React”
• “My needs are simple. I don’t need something
complicated like Backbone, I can get by just fine
Backbone’s Big Ideas
• Data - View Separation
Data - View Separation
• Models & Collections handle data and
• Views handle display
• Everything is replaceable
• Good defaults where possible, decisions left to
the user otherwise
• Reflected in the ecosystem that has grown up
• Simple to learn
• No Lock-in
• No wasted code for most applications
• Solve problems however you want within a
• Explicit Code, no magic
• Readable short source (under 2k LOC)
• 5 simple concepts
Lines of Code
Backbone Angular Ember React
It’s not about the bandwidth. It’s about
being able to understand what’s
What Value Do These Ideas
• Usable by anyone
• Fast Learning Curve
Technology for Maintainable
• Must be able to respond to change, without
requiring constant rewrites
• Must be able to bring on new developers quickly
• Have confidence that a technology will last