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 8254371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:09:58+00:00 2026-06-08T01:09:58+00:00

Something I find very counter-intuitive about Ember is you can overwrite a computed property

  • 0

Something I find very counter-intuitive about Ember is you can overwrite a computed property setter functions ( http://emberjs.com/#toc_computed-properties-setters ) with the arguments to create(). See http://jsfiddle.net/zJQJw/2/

I found the best workaround for this is to call create().setProperties(properties) instead of create(properties), but this seems like an unnecessary gotcha to me. I realize it might break some apps at this point, but would you consider making create() behave more like setProperties()?

My motivation for asking for this is that init() will be called before setProperties() when using the create().setProperties(properties) pattern. This hasn’t been a big problem yet, but I can see this being undesirable in some situations. This is a completely contrived example, but maybe you can see what I am getting at? http://jsfiddle.net/QJ8vX/2/

The only reason I can see for maintaining the current behavior is to do instance-specific overrides of setter methods. But in those cases you could just as easily do MyClass.extend({ overridenMethod: ... }).create(properties)

Would a change like this be considered for Ember 1.0? Or do I just have the wrong idea about how Ember’s object model should work?

  • 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-06-08T01:09:59+00:00Added an answer on June 8, 2026 at 1:09 am

    The main reason why we’ve pushed back on this change is that it makes it impossible to override properties that are defined on base classes as computed properties. For example, in Ember.View, the template property is a computed property:

    template: Ember.computed(function(key, value) {
      if (value !== undefined) { return value; }
    
      var templateName = get(this, 'templateName'),
          template = this.templateForName(templateName, 'template');
    
      return template || get(this, 'defaultTemplate');
    }).property('templateName').cacheable(),
    

    When creating a subclass of Ember.View, you may want to override this definition with an explicit template function:

    Ember.View.create({ template: Ember.Handlebars.compile('...') });
    

    If the computed property doesn’t handle the setter case, this attempt to override the computed property would be a silent failure.

    If we made this change, it also introduces other questions about whether observers should trigger for properties passed into the create method. Both are possible to implement, and there are strong arguments for both approaches.

    In the run-up to 1.0, it seems reasonable to consider an approach that would:

    • change create to use setProperties semantics
    • add a new API (override or createWithOverride) that would retain the existing semantics, in case you explicitly wanted to override existing computed properties
    • suppress observers for properties set due to create (or decide not to)
    • find a way to detect and warn about attempts to use the create API with computed properties that do not implement setters.

    I would need to discuss it more, and consider the implications to existing apps, but it is definitely something worth considering, as it is definitely a pretty big gotcha for new developers. The fact that we needed to change the behavior for ember-data is a pretty good clue that something isn’t quite right.

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

Sidebar

Related Questions

This is a very simple question, but I can't seem to find something about
I must be missing something very simple, but can't find the answer to this.
I'm trying to do something very simple, yet I can't seem to find the
Coming to OCaml from Lisp, I find myself very confused about when functions return
weirdly I cannot find something simple about this, I've got 2 entity, one inside
This probably is a very very basic question but i can't seem to find
I've just started working with Dapper and I don't seem to find something very
sorry, I did not find something useful when searching google. Very basic question, mainly
I'm asking this partially because it is something I would find very useful, but
I find this very strange, must be something I'm doing wrong, but still... I'm

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.