# Basic functions vs computed properties

**URL:** https://discuss.emberjs.com/t/basic-functions-vs-computed-properties/2129
**Category:** Design
**Created:** [August 12, 2013, 6:12pm UTC](https://discuss.emberjs.com/t/basic-functions-vs-computed-properties/2129 "2013-08-12T18:12:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![eccegordo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/eccegordo/32/14927_2.png) [@eccegordo](https://discuss.emberjs.com/u/eccegordo)
#### Post date: [August 12, 2013, 6:12pm UTC](https://discuss.emberjs.com/t/basic-functions-vs-computed-properties/2129/1 "2013-08-12T18:12:52Z")

</div>

Any tips or advice on when it is appropriate to use straight javascript functions vs computed properties inside a controller?

Beside calling syntax differences, are there any other important considerations to take into account?

I presume you lose out on some of the observer functionality. And implicitly calls to your function are synchronous so any advantages of the ember run loop are lost. Access to function is not possible in handlebars template unless it is a property?

What about custom promises in the controller?

I am trying to figure out it is OK to use the first approach of these two

```
App.ApplicationController = Ember.Controller.extend({
  myProperty: "some prop",

  myMethod: function () {
    var variable = "foo";
    return variable;
 }     
});

```

vs

```
App.ApplicationController = Ember.Controller.extend({
  myProperty: "some prop",

  myMethod: function () {
    var variable = "foo";
    return variable;
 }.property()     
});

```

Obviously the calling syntaxes are different.

elsewhere in a route…

basic function:

```
this.controller.myMethod();

```

vs property

```
this.controller.get('myMethod');

```

Are there cases where it doesn’t make sense to use a computed property?

---

<div class="post-metadata">

### Author: ![pwagenet](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pwagenet/32/14172_2.png) [@pwagenet](https://discuss.emberjs.com/u/pwagenet)
#### Post date: [August 13, 2013, 7:43pm UTC](https://discuss.emberjs.com/t/basic-functions-vs-computed-properties/2129/2 "2013-08-13T19:43:09Z")

</div>

> [@eccegordo](#):
>
> Are there cases where it doesn’t make sense to use a computed property?

In general, I’d say you shouldn’t use CPs when it’s not a property 🙂

If you’re working with methods that behave like properties, i.e. they have no side-effects and return a value, use CPs. On the other hand, if you’re doing something that has a side-effect, then it definitely shouldn’t be a CP.
