lundi 13 mars 2017

Inconsistent model in client side and server side?

I am using angular 2 for client side, and for backend mostly Spring Rest services and Java EE. I am very new to JavaScript world, There is a "user" model in angular side which captures client side user info, I have written a server side POJO for representing this model in server side, however this approach seems to tightly couple this model with client side, every time a new field is added/removed from client side "user" , I have to modify my own POJO. Is there any design pattern which tackles this problem, Will a DTO be good choice which will have only a subset/superset of user data and then another POJO ? I think it's a very common scenario, how do other developers tackle this problem? Did lot of googling, only thing they are suggesting is to use node stack entirely to eliminate this disparity in client side and server side but that does not fit my situation. Any suggestions are welcome. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire