| Author |
URLYBird DBMain basic question
|
Mo Negargar
Greenhorn
Joined: Dec 13, 2002
Posts: 6
|
|
Hi all, Looking at my assignment, UrlyBird 1.3.2, DBMain interface contains the following comment: public interface DBMain { // Reads a record from the file. Returns an array where each // element is a record value. public String [] read(int recNo) throws RecordNotFoundException; // rest of the code } The way I am thinking about doing data reads is to read all the data into an ArrayList at first use and then use the read method of the above interface to read from the ArrayList. The comment however, states that this method "Reads a record from the file". Well, technically speaking I am not reading from the file but from the memory. Is this likely to cause a problem? Thanks in advance Mo.
|
 |
Martin Sturzenhecker
Greenhorn
Joined: Dec 11, 2005
Posts: 23
|
|
Hi Mo, your approach should not be a problem as long as the effect of what is done makes it look as if the record were read from the file. This means you have to ensure that your "record cache" keeps somehow in sync with the data file. As far as I saw a couple of other threads in the forum deal with record caches as you describe it. I for my part will not use a cache and read/write the file instead. regards -martin
|
 |
hassan kalaldeh
Greenhorn
Joined: Oct 12, 2005
Posts: 9
|
|
hi Mo, if u ask me i prefer to deal with file, cuz it hard to keep the memory and file as synchronous , so i think it's more effecient to use the file but i think lot of people are using the memory approach here !!
|
T.F
|
 |
Marcio Aun Migueis
Ranch Hand
Joined: Sep 15, 2003
Posts: 32
|
|
Mo, Using a cache is a good idea but could open new doors for bugs. So, I suggest you to avoid the cache solution for this assignment. regards M�rcio [ December 26, 2005: Message edited by: Marcio Aun Migueis ]
|
 |
Saheed Adepoju
Ranch Hand
Joined: Jun 23, 2004
Posts: 267
|
|
Hi all I believe it depends on choice! I am using a cache cause i believe it would make it easier for me to deal with it than deal with the actual file! Well i suppose keeping it in sync is always the problem! Just remember to update the actual file before updating the cache! As long as you can defend your self in using a cache, you can go on ahead! Dont use a cache cause your friend down the road doing the SCJD is using one ! Anyways have fun!
|
Saheed Adepoju<br />SCJP 1.4<br />SCJD (B&S..In progress)
|
 |
 |
|
|
subject: URLYBird DBMain basic question
|
|
|