Hacker News new | ask | show | jobs
by randomdata 5417 days ago
The same could be said of any language you are unfamiliar with. Ignoring the inheritance, which should be familiar to anyone with class-based OO experience, that code basically translates to:

    function ItemView() {
      this.render = function() {
        this.options.items.each(this.renderItem.bind(this));
      }

      this.renderItem = function(item) {
        this.el.append(item.get("title"))
      }
    }
In this example, I don't see any significant difference as far as readability goes, to be honest. I will note, in case it is not entirely clear, that the use of Backbone in the example is unrelated to CoffeeScript.
1 comments

Except you left out setting the prototype chain to extend from the super class. CoffeeScript expresses it succinctly. The example above, while readable, already has much more noise than signal.