Reputation: 1451
Almost all articles say that tying data to the DOM is bad. But what does that mean, exactly; and how can I avoid it?
Upvotes: 2
Views: 283
Reputation: 5143
Usually separating application logic, data and the display of data makes the application itself more clear and easy to maintain. Usually each part has their own separate problems (how to organize user data (model) is not related to what color/position username should be shown in on screen). How the username is transferred to the screen (controller) is also separate from the display (view).
I don't know which case you mean by tying data to the DOM, but one risk is that your model & view get mixed and it becomes difficult to separate display from data.
One way of doing this is MVC (model-view-controller) division and other similar separations like MVVM etc. Some more about MVC here.
Upvotes: 1