4 ms·
Jeremy, first of all. Thanks for Backbone! You guys rock. I'm glad you liked my post. Regarding "keeping models simple". Perhaps I wasn't so clear. My point h
by HenrikJoreteg 16y ago
Jeremy, first of all. Thanks for Backbone! You guys rock.
I'm glad you liked my post.
Regarding "keeping models simple". Perhaps I wasn't so clear. My point here was mainly just that when I first started trying to build a model layer separate from the DOM (pre-backbone). I was very explicitly defining what attributes each model has and then also doing the corresponding DOM manipulations in my setters and getters. That got messy pretty quickly.
So, my point was not that you shouldn't add methods to your Backbone.Model's, but rather that you should keep view and controller logic out of your model layer.
- jashkenas 16y agoAh, great -- we agree then after all. Models contain sophisticated domain logic, but know nothing about HTML or DOM manipulation. Perhaps that point could be expanded with a bit more nuance at the end of article.