2nd April, 2018 | Blog |

JavaScript Development: What is Backbone.js?

Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on.

View Plans

Backbone.js is a form of JavaScript framework that benefits from cross-platform performance and the opportunity to create not just on mobile devices, but a range of other media too.

Backbone.js plays well with a range of different systems, including Ruby on Rails, and jQuery. With this framework, you can add structure and performance features to your JS applications. The service adds to models with custom events and key-value minding amongst other things and connects to your existing API over a REST interface.

Currently, the Backbone.js project is hosted on Github, and there's an annotated source code available for those who want to start experimenting today. There's also an advanced list of tutorials available, an example application, and a test suite available too.

Introducing Backbone.js

In it's simplest form, Backbone.js is a lightweight and efficient JavaScript framework designed by a man called Jeremy Ashkenas in 2010. Backbone ships with a single dependency on Underscore.JS, which offers the underlying templates that Backbone builds with. Many consider Backbone.js to be more of a small MVC library, rather than a full-fledged framework. This is because Backbone.js exists essentially as a useful set of tools that deliver the basic skeleton of a structure. It's up to you to flesh out the remaining parts of the application.

The components of Backbone include:

The Benefits of Working with Backbone

So, why do developers use Backbone.js? One reason is that it's extremely small and lightweight. The fact that it doesn't take up much memory means that it's fantastic for developers who want to create high-performance but simple web page applications. While there might not be as many advanced features on Backbone.js as there are on other frameworks, it's a powerful foundation for building up other framework systems.

Backbone's structure is also extremely clear, flexible, and easy to use, with fewer rigid guidelines than other solutions. Backbone provides a sensible structure for an application or web development. When you combine this with the powerful event system that ties everything together, you have a wonderful JavaScript experience. Some of our favourite features include:

1. Event-Driven Communications

Backbone.js makes it quick and simple to create small and light-weight applications with frameworks that stand the test of time. While you can always design basic applications with jQuery, when your project starts to grow, the jQuery callbacks become more cluttered and difficult to read.

Backbone.js alleviates this problem by creating event-driven communications between models and views. You can attach event listening solutions to any attribute within a model, which helps to give developers a granular level of control over what they change as they design.

2. Back-end Syncing

Another positive aspect of Backbone.js is that the models within this system can tie easily to the back-end of a web application or site. Out of the box, this framework comes with everything you need to support REST-based APIs and models that map to RESTful endpoints. If your APIs are well-designed, then Backbone.js will already be configured to access them directly for various operations, including reading, writing, and deletion. However, if your backend is something other than a RESTful API, then your Backbone.js should still be flexible enough to accommodate for this.

3. Convention Support

Finally, in the development world, conventions are a great way to introduce common coding styles to a system without the need for an in-depth coding standards system. The more developer stick with specific backbone conventions, the less they'll need to code in the long-term, and the more readable their code becomes.

When to Use Backbone.js

Ultimately, it's worth considering Backbone.js if you're designing a simple single-page application with very few dependencies. If your back-end does most of the heavy lifting on your behalf already, and you're in need of speed above all else, then Backbone.js could be perfect for you. It takes up less space than other solutions like Angular.JS, and it also often scales much better when it comes to performance. Of course, it's worth noting that the more complicated and heavy-duty your application becomes, the more likely it is that you'll need to add custom code and third-party plugins into the mix to make everything work as it should. With the right developer, Backbone. JS can provide a degree of flexibility to ensure that you get the features you want in your app.

Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on.

View Plans