| Author |
Reading from the database -- help
|
Derick Potgieter
Greenhorn
Joined: Feb 19, 2004
Posts: 13
|
|
I want to know something about reading from the database. I decided to do direct editing, reading from the database with RandomAccessFile. Now there is two pieces of code i can use. I`m not sure which one would be better. code number one uses 2 for loops, creates a string array with all the values. Code number two makes an temp DatabaseSchema object. then reads the data byte by byte and set the values of the temp object.(this is all the columns in my database) option 1 is a better loop and looks nice, only 10 line, but i still have to convert the String[] to my DatabaseSchema option 2 i can actually set the values on the DatabaseSchema directly but it is very long about 30-40 lines and looks dodgy(code is the same for all fields but only the object.set??? changes each time) do you think that the examiner will mind about option 1 or should i rather take the long way and be safe?? thanks Derick
|
 |
Jon Entwistle
Ranch Hand
Joined: Feb 20, 2003
Posts: 118
|
|
I don't think it is a case of what the examiner would mind - more a case of documenting important design decisions and being able to justify your choice. There is no single 'correct' answer. I would go whichever you are most comfortable defending, bearing in mind the overall goal of clarity and maintainability. hth Jon
|
SCJD, SCEA
|
 |
 |
|
|
subject: Reading from the database -- help
|
|
|