I am creating an iOS and Android app. The app will track the same data on each platform, but on iOS I will use Core Data and on Android I will use MySQLite for persistent storage.
This app will allow up to 5 people to play 10 rounds of a game where the users will enter data for approximately 8 different categories. (For a given user, each round will consist of storing data for 8 different things.) I’m trying to determine which is the better approach for data storage and app performance.
The 2 options I can see are (for the iOS folks, yes I know we’re not talking about tables and columns with Core Data, so substitute those words with Entity and Attributes):
Option 1:
One table that has 10 columns representing each round, and the value of each column is a concatenation of the 8 different categories, separated by an asterisk.
Example: <Player 1> Column 1 = a*b*c*d*e*f*g*h , Column2 = i*j*k*l*m*n*o*p , etc...
Option 2:
Eight tables that represent the 8 categories. Each table has 10 columns to represent the 10 rounds of play.
Example: <Player 1 - Table 1> Column 1 = a , Column 2 = b , Column 3 = c , etc...
<Player 1 - Table 2> Column 1 = a , Column 2 = b , etc...
For option 1, I would have to build up the string before storing it, and then deconstruct the string when accessing it later. This isn’t hard obviously, it just takes more processing time.
For option 2, I’d have more underlying storage on devices that have limited storage capabilities (no matter which route I choose, I already have other tables of data too). The information would be easier to access.
I was leaning towards option 1 due to its lower storage requirements. Any thoughts are greatly appreciated. I mentioned how I was setting up my apps on the different platforms in case it makes a difference.
What about a table for player actions with the following columns (I assumed the categories are fixed):
This way it should be easier to query data later.
On a side note, if you use Core Data for iOS, you may consider greenDAO for Android.