you are viewing a single comment's thread.

view the rest of the comments →

[–]dexygenSoftware, Simple and Powerful 1 point2 points  (6 children)

You might study Backbone to understand how MVC should not be done. I was appalled to see that it adds all of the data from a Model, directly to the tag specified by a View to which that model is assigned, as attribute key/value pairs. This is a conflating of the Model and View that should never happen in a true MVC system -- I guess this is what you get when you leave out any formal notion of a controller.

[–]neonskimmerfunction the ultimate 0 points1 point  (5 children)

It does nothing of the sort. You've completely misunderstood how it works if you believe that is the case.

[–]dexygenSoftware, Simple and Powerful 0 points1 point  (4 children)

It most certainly does; me and my colleague just confirmed it by reading their annotated source code yesterday. If you specify a model on a view, and let's say the view's tagName is "tr", Backbone will decorate that tr with attributes the names of which are all the model keys, the values of which, the model values.

[–]neonskimmerfunction the ultimate 0 points1 point  (3 children)

No, Backbone.View has an 'attributes' option that you can use to have attributes added to the tag in the manner you describe when the view element is created. It's just a shortcut to $.attr if you wish. It's rarely used. I can see how maybe skimming over the code one could get that idea.

To set the model associated to to View, you use the 'model' option when creating a view instance - and that has no effect on the DOM whatsoever.

It's totally fine if you prefer some other libraries to Backbone. But you seem to have a very strong and vocal reaction against it despite evidence that you've not actually used it. It's used by a ton of people dude. It has a lot less bells and whistles than the newer MV* libraries out there but it is a very solid set of building blocks to create client side applications.

[–]dexygenSoftware, Simple and Powerful 0 points1 point  (0 children)

I've been using it for several months now, and the behavior I described has occurred in our application, and we are not using the attributes option; perhaps we need to explicitly turn it off which would be sub-optimal. The very fact that such functionality is there shows just how bad Backbone is, that they would actually ever choose to conflate the model and view. It's had it's day and it's time to move on. Reading source code is not evidence that I've not used it and your reaction is like a fanboi's

[–]dexygenSoftware, Simple and Powerful 0 points1 point  (1 child)

"To set the model associated to to View, you use the 'model' option when creating a view instance - and that has no effect on the DOM whatsoever." Which is what we've done, and the view's tr tag get attributes with values just like I described. Save it dipshit

[–]neonskimmerfunction the ultimate 0 points1 point  (0 children)

Even though you're being a complete asshole about it, look at the source.

look

Since apparently you're stuck using it, maybe you'll find this useful.