2

My application

  1. UITableView has 200 rows
  2. In edit mode each cell has two actions for eg: passAction and failAction
  3. After editing i want to update the database with either 0 or 1 based on its selection
  4. I am retrieving data from server as json and storing it as object

Which is Best?

a. Requesting the server on each time the action is called.

b. Storing it in the local database and sync on completing all rows.

c. Request the server once on completion and send the whole object as JSON.

Help me in choosing the best option of implementation I can do!

Correct me if I bypassed any rules of SO because this is my first question!

Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
Boopathy
  • 415
  • 3
  • 12
  • 1
    I will go with **Option C** and never **Option B**. – Fahim Parkar May 28 '15 at 11:48
  • @Parkar, Thank you! I had lot of confusions in my mind and it got cleared with your comment. Also i got some new ideas. Thanks again for giving me the spark Mr.Parkar! – Boopathy May 28 '15 at 11:58
  • 1
    @FahimParkar, Why **never** option B? Wouldn't B be the option if you wanted to implement the ability to defer synchronization while a user is offline? (Honest question) Thanks! – Dan Beaulieu May 28 '15 at 12:06
  • @DanBeaulieu : All 3 options have plus and minus... So I will not say this is best... for me, C is expensive... B will only occur when internet is lost but if option B comes means you don't have internet and you cannot use app itself... so B is useless to think... – Fahim Parkar May 28 '15 at 12:34
  • Thanks for elaborating @FahimParkar – Dan Beaulieu May 28 '15 at 12:35
  • @DanBeaulieu : I meant B is expensive ( in-terms of time) – Fahim Parkar May 28 '15 at 13:50

1 Answers1

3

@Dan Beaulieu: No need to send all data to server after edit. First update your database and Just send data which was changed in your database. So add one field like "sync" in your database table and updated field set sync = 1 during edit and get data from database which was set sync = 1 and send it to server.

Parthpatel1105
  • 541
  • 6
  • 17
  • @Parthpatel, First of all the question was asked by me and my scenario is totally different from what you are saying..! – Boopathy May 28 '15 at 13:09