How important is it that models be consistent across project components?

Posted by RonLugge on Stack Overflow See other posts from Stack Overflow or by RonLugge
Published on 2012-12-01T23:00:14Z Indexed on 2012/12/01 23:03 UTC
Read the original article Hit count: 135

Filed under:
|
|
|

I have a project with two components, a server-side component and a client-side component. For various reasons, the client-side device doesn't carry a fully copy of the database around.

How important is it that my models have a 1:1 correlation between the two sides? And, to extend the question to my bigger concern, are there any time-bombs I'm going to run into down the line if they don't? I'm not talking about having different information on each side, but rather the way the information is encapsulated will vary. (Obviously, storage mechanisms will also vary) The server side will store each user, each review, each 'item' with seperate tables, and create links between them to gather data as necessary. The client side shouldn't have a complete user database, however, so rather than link against the user for gathering things like 'name', I'd store that on the review. In other words...

--- Server Side ---

Item: +id //Store stuff about the item

User: +id +Name -Password

Review: +id +itemId +rating +text +userId

--- Device Side ---

Item: +id +AverageRating

Review: +id +rating +text +userId +name

User: +id +Name //Stuff


The basic idea is that certain 'critical' information gets moved one level 'up'. A user gets the list of 'items' relevant to their query, with certain review-orientation moved up (i. e. average rating). If they want more info, they query the detail view for the item, and the actual reviews get queried and added to the dataset (and displayed). If they query the actual review, the review gets queried and they pick up some additional user info along the way (maybe; I'm not sure if the user would have any use for any of the additional user information).

My basic concern is that I don't wan't to glut the user's bandwidth or local storage with a huge variety of information that they just don't need, even if proper database normalizations suggests that information REALLY should be stored at a 'lower' level.

I've phrased this as a fairly low-level conceptual issue because that's the level I'm trying to think / worry over, but if it matters I'm creating a PHP / MySQL server that provides data for a iOS / CoreData client.

© Stack Overflow or respective owner

Related posts about oop

Related posts about mvc