I am building a web app using backbone.js as an MVC framework. I am struggling in designing my models. I have one parent/main object but it is quite complex/nested in nature i.e over 50 attributes and some nesting going on. What i am struggling with is:
I have something like:
{section1:{
key1:"value1",
key1:"value2"},
section2:{
key1:"value1",
key1:"value2"}
}
Should i flatten the object out like:
{section1_key1:"value1",
section1_key2:"value2",
section2_key1:"value1",
section2_key2:"value2"
}
or should I:
- use the backbone-nested plug-in and pass in the large nested JSON object as is?
- or create separate models for each section and nest somehow within the parent model.
- or simply create models for the child objects and not worry about the nesting and add some type of reference
Suggestions appreciated.