• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URLYBird DBMain basic question

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !!
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic