Live data from Hacker News

Rethinking Backbone.js View Rendering

elving.me

31–32 of 32 posts

Re: Rethinking Backbone.js View Rendering

#31
post #15

Earlier quoted context omitted.

It can get pretty messy at times.

try CoffeeKup: https://github.com/mauricemach/coffeekup or Teacup: http://goodeggs.github.com/teacup/

Why can't people just use regular HTML for markup? Coffeescript is beautiful when you are composing short succinct functions but this just looks like more work for my brain.

Re: Rethinking Backbone.js View Rendering

#32

Earlier quoted context omitted.

I'm afraid I do mean "real logic" -- in terms of "real function calls", or "real math", or whatever else you might want to do. Let me imagine a few more examples: inflector.addCommas(arrayOfNames) document.publicNoteCount + document.privateNoteCount format.quote(email.selectedText()) ... you always can stuff all of those things into an arbitrary "viewmodel" JSON object somewhere else outside of the template, but it's…

We agree on having a single source of truth. I'm arguing for it to be derived in a controller and not in a view.

Then the controller becomes a second source of truth, no?
Post reply on HN