Hello. The question concerns the organization of the backbone models on the client.

On the server there is a user model, which contains various kinds of fields:

  • personal information
    • Name
    • Surname
    • Date of Birth
  • other information
    • About me (text)
    • Interests (text)

On the page it is all divided into two forms - the form of personal information and the form of other information. Accordingly, api was written so that for each form there was loading and saving only those fields that are in this form. Methods respectively GET and PUT.

Well, I’ve got a question with backbon - how to organize the models correctly? In my case, I see the following division - I declare each model by model, for example, UserPersonalModel and UserOtherModel, I add url to each of them and use it.

Or would it be correct not to separate the models and write one UserModel, and preserve the separation into different parts, like .savePersonal, .saveOther methods?

    1 answer 1

    Both options are correct. In the first option, you save the data in portions. With the second all at once. Overhead costs are minimal in the first, that in the second case.

    Personally, I use the first method.