It's not a secret anymore!
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLYBird DBMain basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLYBird DBMain basic question" Watch "URLYBird DBMain basic question" New topic

URLYBird DBMain basic question

Mo Negargar

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

Martin Sturzenhecker

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.

hassan kalaldeh

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 !!

Marcio Aun Migueis
Ranch Hand

Joined: Sep 15, 2003
Posts: 32

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.


[ 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)
I agree. Here's the link:
subject: URLYBird DBMain basic question
jQuery in Action, 3rd edition