Re:Backbone UI
by TazeTSchnitzel on Tuesday June 19, 2012 @11:36AM
(#4132374)
Well, one style is imperative, one is declarative. Some prefer the former, some the latter.
Myself, I much prefer imperative.
Using a bunch of calls to appendChild() and setAttribute() results in code that is difficult to read, because it's so low-level. You can't "see" the generated HTML, just like in assembly you can't really "see" the code structure.
Whereas using templates lets you "see" your HTML, with an easy-to-understand structure. So it's the natural, default choice for ease-of-use and maintenance.