Backbone.js

Travis HornTravis Horn
2 min read

It becomes apparent that as you start building more and more client-side JavaScript functionality to an application, the code can quickly become a hard-to-maintain mess. You will start to notice yourself trying to build a consistent structure for tying data and events to page elements. Most of the time, for small projects, this is fine. For large projects, however, I’d recommend a supplimental library such as Backbone.js.

Backbone provides a structured platform for developing your JavaScript-heavy applications. It is similar to an MVC and, in fact, has the same goal as a traditional MVC in mind. However, it uses models, collections, routers, and views.

From http://documentcloud.github.com/backbone/:

With Backbone, you represent your data as Models, which can be created, validated, destroyed, and saved to the server. Whenever a UI action causes an attribute of a model to change, the model triggers a “change” event; all the Views that display the model’s state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information.

By writing your application with Backbone, you’re keeping your code in a clean, strict environment, using RESTful services. It also takes care of much of the boilerplate code you’d have to write for interactive apps, and provides you with a best-practice environment that will be easier for you or any collaborators to maintain.

If you’re looking for more information, a good way to familiarize yourself with Backbone is by checking out real-world examples. If you’re looking to learn how to get started, I like this tutorial by Thomas Davis.

0
Subscribe to my newsletter

Read articles from Travis Horn directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Travis Horn
Travis Horn

I have a passion for discovering and working with cutting-edge technology. I am a constant and quick learner. I enjoy collaborating with others to solve problems. I believe helping people achieve their goals helps me achieve mine.