So as the title says, I'm creating an Android application with an SQLite database. This database will be synchronized with a MySQL database connected to a homepage (and also in the future the MySQL database will be used in conjunction with IPhone).
If the user makes a change on the android system or the MySQL database it will synchronize the data between the two when an internet connection is available.
The first question is - How will I be able to know which one of the databases that contains the last version? I cannot trust the timestamp since anyone can change the time-setting on their phone, right?
The second question is more of a design-issue, see the attached image:
The current plan for the design is using some kind of DataAccessObject pattern, which will help me with the data access, the SQLiteDb will be used for speed the first time a listview (for instance) is showed to the user and it will be updated in the background by the HttpUserDAO.
I've got the feeling that this is not "good design" - coming from PHP when I'm used to work with Doctrine2 this just feels wrong somehow.
Is there any other pattern I should read up on, when handling the database and objects? (I'd like to stay away from ORM frameworks right now to have some more control myself) Or should I just use pure data access objects without building the model objects? Any tips? I get stuck when using data access objects or active record when trying to design for "objects owning objects" that should be saved to the database.
Thank you for your help!
Aucun commentaire:
Enregistrer un commentaire