# Backbone.js

Backbone.js is an open-source JavaScript framework for structuring web applications with models, collections, views, events, and RESTful API integration.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## A Front-End Development Experience Working on the TextSecure Chrome Browser Extension

DevFeed: [A Front-End Development Experience Working on the TextSecure Chrome Browser Extension](<https://devfeed.tech/articles/star-quality-1850.md>)

Original publisher: [Read original article](<https://signal.org/blog/star-quality/>)

Published: 2015-01-14T00:00:00Z

Content type: opinion

Language: en

Sources: [Signal](<https://devfeed.tech/sources/signal-blog.md>)

Topics: [software-development](<https://devfeed.tech/topics/software-development.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [WebExtension](<https://devfeed.tech/topics/webextension.md>), [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Pull Request](<https://devfeed.tech/topics/pull-request.md>), [Google Chrome](<https://devfeed.tech/topics/google-chrome.md>), [Git](<https://devfeed.tech/topics/git.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [browser](<https://devfeed.tech/tags/browser.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [extension](<https://devfeed.tech/tags/extension.md>), [front-end](<https://devfeed.tech/tags/front-end.md>), [front-end-development](<https://devfeed.tech/tags/front-end-development.md>), [git](<https://devfeed.tech/tags/git.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [pull-requests](<https://devfeed.tech/tags/pull-requests.md>)

### AI overview

A personal account of learning front-end development while contributing to the TextSecure Chrome Browser Extension. The author describes using Backbone.js, Grunt, Bower, Mustache, Git, and pull requests while separating phone-number input into a reusable Backbone.js view and validating it across multiple HTML pages.

### Source excerpt

Winter Break Of Code Day 2 Because I might get sappy, here's a picture to ease that before I let it all out. After being promptly woken up by numerous roosters at 7:30 AM, I still can't believe I'm here. My application was pretty last-minute, completed when I was in a state of droopiness and scholarship-application-hyperdrive. But I got on a plane from the Midwest, went from cloudy, 20 degrees with windchill making it feel like 0 to sunny, 77 degrees with mild winds making it feel still 77 degrees. Read more...

## Embracing Command Line Tooling with Backbone Applications

DevFeed: [Embracing Command Line Tooling with Backbone Applications](<https://devfeed.tech/articles/embracing-command-line-tooling-with-backbone-applications-52455.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/command-line-backbone-yeoman/>)

Published: 2014-03-31T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [software-development](<https://devfeed.tech/topics/software-development.md>), [Developer Tools](<https://devfeed.tech/topics/developer-tools.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [applications](<https://devfeed.tech/tags/applications.md>), [automate](<https://devfeed.tech/tags/automate.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [front-end](<https://devfeed.tech/tags/front-end.md>), [generate](<https://devfeed.tech/tags/generate.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [less](<https://devfeed.tech/tags/less.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [online](<https://devfeed.tech/tags/online.md>), [runner](<https://devfeed.tech/tags/runner.md>), [sass](<https://devfeed.tech/tags/sass.md>), [speed](<https://devfeed.tech/tags/speed.md>), [tests](<https://devfeed.tech/tags/tests.md>), [tooling](<https://devfeed.tech/tags/tooling.md>), [tools](<https://devfeed.tech/tags/tools.md>)

### AI overview

The tutorial shows how Yeoman's Yo, Bower, and Grunt tools can automate setup and development of a Backbone app. After installing Node.js, npm, and Git, install Yo and the Backbone generator globally, then use `yo backbone` to scaffold an app and choose optional features. The generated project includes Bower-managed libraries, Grunt tasks, and a test setup. The examples use Grunt to serve the app with automatic refresh, run Mocha tests, and compile templates; Yo can also generate a model and view. The book example adds a model summary method, tests it, and renders it through an EJS template. The excerpt presents this as a way to reduce repeated setup and build work, but does not cover the full range of Grunt tasks or deployment details.

### Source excerpt

In this article I'll take you through how we can use command line tools such as Grunt, Bower and Yeoman to speed up our typical development workflow. Today I'll be using the example of a Backbone application, but it's easily applied to any other type of front-end application or web site you might be building. The use of tools on the command line has really increased over the past two years, particularly when it comes to tools for working on the front-end. We've seen the rise of Node.js, enabling us to run JavaScript on the command line which consequently has seen developers write scripts to automate part of their workflow. You may already use some of these tools to run preprocessors such as Sass, LESS, CoffeeScript or another. Embracing a tool like Yeoman lets you move away from a lot of the manual lifting that comes with setting up and then working on a project. For example, until I used Yeoman I would often create new projects from scratch; creating the folder structure, creating my initial JavaScript files and downloading any resources I needed manually by finding them online. Not only does this take time, but it's something us developers have to do so frequently, that it's silly not to automate this. Yeoman will set this up for you, along with a lot else. Things like upgrading to the latest version of a library, or minifying your JavaScript before deployment, can be done in an instant with a proper tool chain. Today we'll be using the modern workflow as defined on the Yeoman site. This consists of three parts: Yo. Yo is the tool built by the Yeoman team to quickly generate a project and scaffolding out a new application. Bower. Bower is used for managing dependencies, so there's no longer any need to manually download library source files yourself. Grunt. Grunt is a JavaScript task runner and contains tasks for running your app's tests, building a minified and ready for deployment version of your app, and much more that we'll see shortly. Yo Before we can look a

## Exploring Backbone.js - Part 3

DevFeed: [Exploring Backbone.js - Part 3](<https://devfeed.tech/articles/exploring-backbone-js-part-3-52477.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/exploring-backbone-js-part-3/>)

Published: 2013-02-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [performance-optimization](<https://devfeed.tech/topics/performance-optimization.md>)

Tags: [3](<https://devfeed.tech/tags/3.md>), [collection](<https://devfeed.tech/tags/collection.md>), [exploring](<https://devfeed.tech/tags/exploring.md>), [filter](<https://devfeed.tech/tags/filter.md>), [github](<https://devfeed.tech/tags/github.md>), [go](<https://devfeed.tech/tags/go.md>), [js](<https://devfeed.tech/tags/js.md>)

### AI overview

The tutorial filters a Backbone collection by price: `CartCollectionView` handles filter and clear events, while `ItemCollectionView` resets the collection silently, uses Underscore's `filter` to keep models below the entered maximum, then triggers a reset so the view re-renders. Clearing the filter empties the input and restores the full item set. The author notes that input validation is omitted. Initially, filtering after adding an item loses it because the reset uses the original `items` array; listening for the collection's `add` event and updating that array fixes the issue. The event handlers live on the whole-page view, a structure the author says will be tidied up in a later episode.

### Source excerpt

Way back in June last year I published part two of my Backbone series and today, at long last, it's time to pick up the pieces. I apologise for such a lull between articles and hopefully it wont be quite so long between this and the next episode! I recommend you go back and skim Part 1 and Part 2 first just to get up to speed. Last time I left off we had just written the code to add a new item to our collection. What I'd like to do today is look at how we might filter down items in a collection. This will set us up nicely for the next article, which will look at Backbone's Router in more detail. Firstly, lets set up the HTML needed to allow a user to filter down by price. Less Than Clear Filter For now we will keep it simple and just let the user search for items less than a particular price. Next we need to set up some events on our CartCollectionView. If you remember, this view encompasses the entire of our application (its el property is set to "body"), so this is where a lot of our events are set up. If you're thinking perhaps this isn't the best way, you're right. In a future episode when we add a couple more views, we will tidy this up. Add two more events to the events property: events: { "submit #add": "addItem", "submit #filter": "filterItems", "click #clear-filter": "clearFilter" } The methods we need to add to the cart collection view are very straight forward. All they will do is cancel the default action and then call methods on itemView, which is the view that all our items sit within. filterItems: function(e) { e.preventDefault(); this.itemView.filterByPrice(); }, clearFilter: function(e) { e.preventDefault(); this.itemView.clearFilter(); } To filter the items down to those lower than a specific price, here's what we need to do: Loop through every element in the collection and see if it matches the filter. Re-render the item collection view with just those items in. Here's the entire code. Give it a read, and I'll explain it in depth below. filterByPr

## JavaScript MV\* Frameworks

DevFeed: [JavaScript MV\* Frameworks](<https://devfeed.tech/articles/javascript-mv-frameworks-52497.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/javascript-mv-frameworks/>)

Published: 2012-12-03T00:00:00Z

Content type: comparison

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Framework](<https://devfeed.tech/topics/framework.md>), [Programming languages & frameworks](<https://devfeed.tech/topics/programming-languages-frameworks.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Angular](<https://devfeed.tech/topics/angular.md>), [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [Ember](<https://devfeed.tech/topics/ember.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [applications](<https://devfeed.tech/tags/applications.md>), [apps](<https://devfeed.tech/tags/apps.md>), [ember](<https://devfeed.tech/tags/ember.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [net](<https://devfeed.tech/tags/net.md>), [web-applications](<https://devfeed.tech/tags/web-applications.md>)

### AI overview

The article gives a high-level comparison of Backbone, Ember, Angular, Batman, and Knockout, focusing on where each framework's strengths lie to help readers consider which may fit their needs. It cautions against choosing based only on the overview and encourages trying a framework before committing.

### Source excerpt

"The massive growth in rich, JavaScript-heavy web applications has lead to a huge array of frameworks designed to help you build apps. There are so many that it can often be difficult to choose which best suits your needs, so in this article I'll discuss five of the most popular, and look at where each of their strengths lie. You shouldn't base your decision entirely on this article - I encourage you to play further with a framework before committing - but I hope this sets you off in the right direction." Another article I wrote for .net magazine went live last week: Five JavaScript MV* Frameworks. In it I take a look at Backbone, Ember, Angular, Batman and Knockout. It's a high level summary of each so if you've been wondering which may suit your needs best, or what the differences are, I hope it may be of use.

## Exploring Backbone.js - Part 2

DevFeed: [Exploring Backbone.js - Part 2](<https://devfeed.tech/articles/exploring-backbone-js-part-2-52476.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/exploring-backbone-js-part-2/>)

Published: 2012-06-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>)

Tags: [collection](<https://devfeed.tech/tags/collection.md>), [events](<https://devfeed.tech/tags/events.md>), [form](<https://devfeed.tech/tags/form.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [js](<https://devfeed.tech/tags/js.md>), [simple-form](<https://devfeed.tech/tags/simple-form.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>), [view](<https://devfeed.tech/tags/view.md>)

### AI overview

The tutorial adds a simple form for creating items in a Backbone.js collection. It explains that a view's delegated events can target only elements inside its `el`, so it sets `CartCollectionView`'s `el` to `body` to handle form submission. That view prevents the browser's default submit behavior and delegates item creation to a new `ItemCollectionView`, which reads text input values using their IDs, creates an `Item`, adds it to the collection, and renders it in `#yourcart`. The author presents this as one of several possible approaches; the excerpt does not cover the other planned topics.

### Source excerpt

A while ago I kicked off a planned series of Backbone.js tutorials with Part 1, which introduced Backbone as we set up a "shopping cart" - albeit an overly simplified one. Although it's been too long coming, today I've got part 2! I ended part 1 with some bullet points as things I wanted to cover: How do I add to a collection after initialising it? How can I show a filtered set of my objects? How do I let a user add a new item? How do I unit test my Backbone applications? Can I use Backbone.js with CoffeeScript? Whilst I wont be covering them all today, I want to take on the 1st and 3rd bullet point, as they go hand in hand. So today, we'll edit our code to include a very simple form that lets us add a new item. Whilst this isn't so much in keeping with the shopping cart idea, it's the easiest way to demonstrate how to make the changes. In the upcoming parts we will start to model this into the shopping cart application. One thing that has become apparent is that in Backbone there a lot of different ways often to go about the same thing. I'm still learning Backbone too, so if you would have done anything that I do today differently, please let me know in the comments. We need to make some changes to our existing code base. Firstly, in the comments of the prior article it was pointed out to me that setting el to be $("#yourcart") was bad. What I should do is set el to "#yourcart", and then Backbone gives us $el, which is the same as $(el) which of course is $("#yourcart"). Now, the way Backbone works in terms of events, is that you bind an event to an element using the form: events: { "event selector":"method" } This can be any element, however the element has to reside within the View's objects, which is all the elements in whatever you specified as el when declaring the view. This had me stuck for ages!. There are many ways to get around this, but before I cover my solution, I've added this simple form just after the <body> tag: Title Price My first solution was to

## Exploring Backbone: Part 1

DevFeed: [Exploring Backbone: Part 1](<https://devfeed.tech/articles/exploring-backbone-part-1-52444.md>)

Original publisher: [Read original article](<http://www.jackfranklin.co.uk/blog/backbone-js-tutorial-1/>)

Published: 2012-04-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jack Franklin](<https://devfeed.tech/sources/jack-franklin.md>)

Topics: [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [mvc](<https://devfeed.tech/topics/mvc.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [application](<https://devfeed.tech/tags/application.md>), [applications](<https://devfeed.tech/tags/applications.md>), [apps](<https://devfeed.tech/tags/apps.md>), [cdn](<https://devfeed.tech/tags/cdn.md>), [collection](<https://devfeed.tech/tags/collection.md>), [created](<https://devfeed.tech/tags/created.md>), [data](<https://devfeed.tech/tags/data.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [exploring](<https://devfeed.tech/tags/exploring.md>), [extend](<https://devfeed.tech/tags/extend.md>), [framework](<https://devfeed.tech/tags/framework.md>), [functions](<https://devfeed.tech/tags/functions.md>), [github](<https://devfeed.tech/tags/github.md>), [jquery](<https://devfeed.tech/tags/jquery.md>), [model](<https://devfeed.tech/tags/model.md>), [mvc](<https://devfeed.tech/tags/mvc.md>), [parts](<https://devfeed.tech/tags/parts.md>), [shopping](<https://devfeed.tech/tags/shopping.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

The tutorial builds a basic shopping cart with Backbone.js, showing how models, collections, and views work together. It defines an `Item` model with default price and photo values, stores items in a `Cart` collection, and uses Underscore templates with separate views to render each item and append them to a cart container. The page also includes jQuery, which the tutorial loads from Google CDN. It covers initial rendering of sample items; adding items later, filtering, user input, and testing are left as questions for future installments.

### Source excerpt

Backbone.js is a framework that lets us structure our applications using a pattern similiar to MVC (technically Backbone is not pure MVC as the C stands for "Collection"). However, Backbone is a powerful system to use when creating apps that are beyond very basic. When passing & manipulating a lot of data, you should consider using something like Backbone. Since launching this blog I've had a lot of people ask me about Backbone. Although there are a lot of very good resources out there, I have struggled to get to grips with it myself and from the requests I've had I'd suggest a lot of others have too. So, I sat down to create a sample application with Backbone, and in this tutorial - which will span at least 3 parts - we will create a very simplified shopping cart application, with Backbone. As always the source will be on Github and is linked to at the end of this post. The first thing to do is set up our basic page and include our dependencies. Backbone relies on Underscore.js, a set of utility functions written by Backbone's creator, Jeremy Ashkenas (who also created CoffeeScript). You need to download Underscore.js, Backbone.js & include jQuery too, which I do from the Google CDN. The Backbone link can be found above at the beginning of this article, and here's the link for Underscore.js. I've also created a stylesheet & cart.js, which is where the majority of our code will go: Shopping Cart with Backbone The first thing we want to do is create a model. A model is a way we can represent data in an application, and the objects that we have in our application. We're going to have just one thing today, which is items, which sit in a shopping cart. The convention is to name a model as singular & capitalise it, so our model will be Item. To create a model we extend Backbone.Model like so: var Item = Backbone.Model.extend({ defaults: { price: 35, photo: "http://www.placedog.com/100/100" } }); Here I set up the default values for my item. It's going to have three field

## Building the SoundCloud mobile site using backbone.js

DevFeed: [Building the SoundCloud mobile site using backbone.js](<https://devfeed.tech/articles/building-the-soundcloud-mobile-site-using-backbone-js-2007.md>)

Original publisher: [Read original article](<https://developers.soundcloud.com/blog//building-the-soundcloud-mobile-site-using-backbone.js>)

Published: 2011-08-02T00:00:00Z

Content type: article

Language: en

Sources: [SoundCloud Backstage](<https://devfeed.tech/sources/soundcloud-backstage-blog.md>)

Topics: [Backbone.js](<https://devfeed.tech/topics/backbonejs.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [mobile optimization](<https://devfeed.tech/topics/mobile-optimization.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [HTML](<https://devfeed.tech/topics/html.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [audio](<https://devfeed.tech/tags/audio.md>), [browser](<https://devfeed.tech/tags/browser.md>), [cache](<https://devfeed.tech/tags/cache.md>), [client](<https://devfeed.tech/tags/client.md>), [engine](<https://devfeed.tech/tags/engine.md>), [event-delegation](<https://devfeed.tech/tags/event-delegation.md>), [fixed](<https://devfeed.tech/tags/fixed.md>), [flexible](<https://devfeed.tech/tags/flexible.md>), [framework](<https://devfeed.tech/tags/framework.md>), [js](<https://devfeed.tech/tags/js.md>), [mobile](<https://devfeed.tech/tags/mobile.md>)

### AI overview

SoundCloud built a mobile browser site for iOS and Android to let users open shared tracks without loading the desktop site or depending on a native app being installed. A jQuery Mobile prototype showed that a single-page API client was feasible, but its routing and theming did not fit pages generated dynamically from API results; mobile audio streaming also required workarounds. The team chose Backbone.js for its compact, flexible structure, using jquery-tmpl with templates limited to output and iteration, model toJSON methods for presentation data, and a decoration step before DOM insertion. Extensions added pushState URL handling and a sessionStorage-backed client cache. On navigation, the router builds a model and view; the view fetches data, renders and decorates the template, then sets up delegated interaction handlers. The excerpt says a proxy was later added to decorate the API and work around WebKit bugs, while most app behavior remained client-side.

### Source excerpt

Until early this year, there was a gap. A gap between the desktop-targeted main SoundCloud site, what we call the 'mothership', and the...