Backbone.js Interview Questions – Set 01

What is a View in Backbone.js?

A view is the important part of the Backbone.js architecture. In a Backbone.js application, a view is responsible for the end user interface. The view defines the way in which the application looked at the user. The View is also responsible for listening to the events and reacting to them accordingly.

What are the methods of utility in Backbone.js?

Two methods can be used to manipulate the Backbone.js utility:

  1. Backbone.noConflict: It returns the Backbone objects to its original value and provides a facility to store the reference to a backbone. It can be used to embed the backbone on third-party websites, where you don’t want to thrash the existing backbone.
  2. Backbone.$: This property is used when you have multiple copies of jQuery on the page or want to tell Backbone to use a particular object as its DOM / Ajax library.

Explain the Architecture of Backbone.js

backbone.js supports Model-View-Controller architecture that allows developers to separate business logic and GUI logic.

Model: It consists of data and the logic of the data retrieval from the server.
View: It consists of the code which is responsible for the end user interface, i.e., the way in which the application is presented to the user.
Controller: It is the main application logic which controls the behavior of the application. It is a part of the code which acts as a bridge between Model and View.

When do you require Backbone.js?

Backbone.js is required in following conditions:

  • When you are developing a web application that requires a lot of JavaScript.
  • It is required when you want to give structure to your code if your application needs to be scalable.
  • Backbone is useful when a web application has to work with jQuery to traverse the DOM or give animations.
  • When model changes and you want to update the HTML application automatically.

What is Modelbinder in Backbone.js?

Model Binder is a class which is used to bind the model and the view together. The binding is done to archive synchronization.

Explain Backbone.js?

Backbone.js is a light weighted Framework based on JavaScript. It is used to develop the client-side applications which run on a web browser. Developing client-side applications in Backbone.js is pretty easy and consumes a lesser amount of time. It supports Model-View-Controller architecture.

Mention the case where you can use the unbinding function in Backbone.js?

Unbinding function is used to remove the bindings on the model.

What is Collection in Backbone.js?

A Collection can be defined as an ordered set of modules. In Backbone.js, there is a collection class which provides some useful methods to deal with the collections. We can extend the collection class to provide some additional functionalities

Mention some most robust functionalities of Model binder?

Some most robust functionalities of the model binder are

  • It allows the developer to define the scope when binding is created using J-Query.
  • In some of the cases, we can rely on the default scoping rules which are based on the name attribute of HTML.
  • The scoping rules can be redefined if the views are complicated.

In which language, Backbone.js is written?

The backbone.js is written in JavaScript. It is a JavaScript library that contains a RESTful JSON interface.