Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7652935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:53:52+00:00 2026-05-31T11:53:52+00:00

what is the advantage/ reason for backbone-js to use the syntax //using a Model

  • 0

what is the advantage/ reason for backbone-js to use the syntax

//using a Model instance called model

model.get('attribute')

and not

model.attribute

Im just starting to use backbone and I always ind myself trying to access the attributes directly

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:53:54+00:00Added an answer on May 31, 2026 at 11:53 am

    If you look at the source code, the get function just calls to this.attributes[name].

    http://backbonejs.org/docs/backbone.html#section-31

    The benefit, though, is at least two-fold:

    1) a consistent API that reduces the amount of code you are writing

    2) the ability to override the get method and provide more complex access control

    For example, there are several plugins for backbone that override how models work in order to provide nested model capabilities. it’s very easy for them to allow you to write a get method like this:

    model.get("submodel.attr")

    and have that parse out the attr of the submodel sub-model. Without the get method, it would be more difficult to make this consistent with the API.

    The underlying benefit from this is encapsulation, though. Until JavaScript provides true get/set properties that let us write code for getters and setters, we’ll be stuck with work-around methods like Backbone’s get and set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wondered whether there is any good reason for or even an advantage
Is it possible to use a Model inside the layout page? For instance, we
Is there a good reason (advantage) for programming this style XmlDocument doc = null;
What advantage (if any) is there to using typedef in place of #define in
One advantage that comes to my mind is, if you use Poco classes for
Is there any advantage to using __construct() instead of the class's name for a
Is there any advantage of using java.util.concurrent.CountdownLatch instead of java.util.concurrent.Semaphore ? As far as
Is there any performance advantage of using content type application/json sending an object serialized
Unfortunately we are using the Advantage Database Server Torture Edition Version 8.1. After I
Is there any performance advantage to using lists over dictionaries over tuples in Python?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.