What problem does backbone.js solve?

Solution 1:

I find the question perfectly valid and from my point of view there is nothing wrong with inquiring about the potential use cases of a library/toolkit.

What Backbone.js does (so do several other javascript mvc implementations) is that it provides a means of organizing the code into a modular pattern known as MVC pattern which is all about separating your code into three loosely coupled layers:

  • Model layer dealing purely with data and associated operations
  • View layer being the presentational aspects
  • Controller layer being the binding glue layer

(different frameworks deal with this differently : Backbone implementation of controller layer comprises of client side routing capabilities).

So, on the whole backbone provides you an infrastructure using which you can deal with data through models which contain encapsulated within them the data and associated validations, which can be observed ie. you can bind events to change events.

The View layer is mostly left for the user to separate the ui into manageable isolated sections.

Solution 2:

Here are some problems that Backbone solves for me in the JS/HTML space:

  • Separation of Concerns (SoC)
  • Composability
  • Testability
  • Component Model
  • Abstraction

That is not to say that this is the ONLY system that does this. There are others. Backbone does a pretty good job of helping with these things, though.

Solution 3:

From backbonejs.org

It's all too easy to create JavaScript applications that end up as tangled piles of jQuery selectors and callbacks

And that's exactly what backbone does, a series of callbacks on model changes and jQuery selectors to bind events.

So to answer the question, it solves nothing only to provide a way (the backbone way) of structuring code with some slight automation in the REST side of things.