Research Log of Web Science Students

Computer Science is not simply programming

database dilemma

with 2 comments

This is really a simple task, but there are too many ways on how to do this so we’re having a problem choosing the most appropriate one. In our developmental milestones table in the database, we need to insert initial data. We found at least three methods of implementation for this task.

1.) The hard code method. We will execute the SQL insert statements in the database adapter file, particularly on the onCreate method of the database helper class. This is the easiest way to insert the initial data. However, it is not that practical because we cannot reuse it for other applications that also need the initial data. It would also make our database adapter file really long and may be reduce its readability.

2.) The reusable database method. Create a SQLite database (most probably with the use of an SQLite browser). Populate the database then just copy the database into application. This is a good idea because the whole database will now become reusable. If ever we try to implement the application in another platform, we can just copy the database file.

3.) The reusable data method. Create a text file containing the initial data, create a Java class for parsing the data, and insert the data into the database. Unlike the second method, only the initial data file is reusable in this method. If another person needs the data but will use a different database schema, then this method is more practical.

Help? :p

Advertisements

Written by janinaj

September 17, 2009 at 1:06 pm

Posted in BabyBook

Tagged with , ,

2 Responses

Subscribe to comments with RSS.

  1. “If another person needs the data…”

    I’ll go with number 3. If that other person needs a new schema then that’s his/her problem. 😛

    Jeune

    September 17, 2009 at 5:35 pm

  2. I vote for 3. This is easier to manage considering that you can, in the future, allow users to download a new version of the data (text file), purge the look-up database and then parse the new data from the new file. Doing so in #2 is quite tedious and not flexible should you want to change the content of the database later.

    rom

    September 17, 2009 at 11:05 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: