If you follow Ember folks on twitter you might have noticed that a bunch of them keep talking about something called prototype extensions and disabling them. What’s that? without getting into much details is what allow us to set observers or computed properties calling .observes or property at the end of a function.

Recently a pull request [1] was open by Stefan Penner to encourage the use of decorator styles for declaring observers and computed properties, in means that instead of declaring our computed properties and observers like:

fullName : function () { // make fullName }. property ( 'model.firstName' , 'model.lastName' ), doSomething : function () { // do something }. observes ( 'model.firstName' , 'model.lastName' )

We’ll use the following syntax

fullName : Ember . computed ( 'model.firstName' , 'model.lastName' , function () { // make fullName }), doSomething : Ember . observer ( 'model.firstName' , 'model.lastName' , function () { // do something })

If you are like “OMG! that Stefan guy is crazy! I have like 1000 computed properties and observers” then no worries, good tool ember-watson got you covered.

Thanks to @kamal we can update our code automatically running the following commands:

npm install [email protected] --save-dev ember watson:convert-prototype-extensions

Also, if you have 1000 observers then think you have $10000 in debt (more about that later).

Do you want to learn Ember with a private tutor? Get my living book Ember CLI 101 and keep your Ember knowledge up to date

[1] - https://github.com/emberjs/guides/pull/110