Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Backbone.js really an MVC? [closed]

backbone.js has been spoken of as an MVC framework for Javascript. But is it?

Here is the description of the model, from http://documentcloud.github.com/backbone/

Models are the heart of any JavaScript application, containing the interactive data as well as a large part of the logic surrounding it: conversions, validations, computed properties, and access control. You extend Backbone.Model with your domain-specific methods, and Model provides a basic set of functionality for managing changes.

Now, that is not my understanding of the model in MVC at all. In my understanding, the model is just the classes that model the domain, so your Student, School and Teacher objects. The controller does performs the business logic on them and interacts with the view for display and receiving input.

This understanding is consistent with the various definitions I find on the web, IE http://en.wikipedia.org/wiki/Model_view_controller:

Model–View–Controller (MVC) is a design pattern for computer user interfaces that divides an application into three areas of responsibility:

the Model: the domain objects or data structures that represent the application's state.

So, my question is: is backbone.js really a MVC framework in any sense, or is it more of just a general way of helping you to glue everything together?

Incidentally, the definition of the Model from backbone.js's FAQ appears to differ from the one I quoted above (also from backbone.js http://documentcloud.github.com/backbone/#FAQ-mvc:

Backbone.Model – Like a Rails model minus the class methods. Wraps a row of data in business logic.

So in what sense is backbone.js really an MVC or not?

(Caveat: I am just evaluating backbone.js currently.)

like image 709
mtyson Avatar asked May 24 '12 21:05

mtyson


People also ask

Is backbone a MVC?

Backbone is a JavaScript MVC library and that's a key difference. In the JavaScript MVC context, a framework usually means that you need to configure your code to get things done.

Do people still use BackboneJS?

Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.

Is MVC pattern still used?

The concept of MVCs was first introduced by Trygve Reenskaug, who proposed it as a way to develop desktop application GUIs. Today the MVC pattern is used for modern web applications because it allows the application to be scalable, maintainable, and easy to expand.

What is the architecture of BackboneJS?

It is based on the Model-View Controller framework that binds data, which is abstracted into models, and DOM which is abstracted into views, using events. It is a JavaScript library. Applications of Backbone. js: Following are the applications of Backbone.


1 Answers

Backbone is one of those MV* (MV-star). There is no controller because the logic that operates the app is in the View (something like M(V+C) instead).

And there is no unified definition for "Model" as it is used differently across different frameworks in different languages. But commonly, models are just an abstraction of the data storage and optionally have a bit of logic like validation, formatting and state change hooks.

like image 73
Joseph Avatar answered Sep 29 '22 11:09

Joseph