title: Knockout: computed observable vs function
body: <p>When using knockout, what is the advantage of using read-only computed observables rather than simple functions?</p>
  
  <p>Take the following viewmodel constructor and html snippet, for example:    ​</p>
  
  <pre><code>var ViewModel = function(){
      var self = this;
      self.someProperty = ko.observable("abc");
      self.anotherProperty = ko.observable("xyz");
      self.someComputedProperty = function(){
          return self.someProperty() + self.anotherProperty();
      };    
  };
  
  &lt;input data-bind="value: someProperty"/&gt;
  &lt;input data-bind="value: anotherProperty"/&gt;
  &lt;p data-bind="text: someComputedProperty()"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Everything here seems to work as you'd expect, so is there a reason why I should instead use:</p>
  
  <pre><code>​var ViewModel = function(){
      var self = this;
      self.someProperty = ko.observable("abc");
      self.anotherProperty = ko.observable("xyz");
      self.someComputedProperty = ko.computed(function(){
          return self.someProperty() + self.anotherProperty();
      });    
  };
  
  
  &lt;input data-bind="value: someProperty"/&gt;
  &lt;input data-bind="value: anotherProperty"/&gt;
  &lt;p data-bind="text: someComputedProperty"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>I notice that the documentation at <a href="http://knockoutjs.com/documentation/computedObservables.html" rel="noreferrer">http://knockoutjs.com/documentation/computedObservables.html</a> states that "...declarative bindings are simply implemented as computed observables", so does that mean there's need for me to use them explicitly in my viewmodels?</p>