File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database with URLyBird

 
Robert Aragon
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an interface Sun wants implemented. It has a series of methods with their signatures. Many of these methods read and write directly to the database.

readRec(long recordNumber) is supposed to read a file out of the database. Is this not a waste of time? Shouldn't the server, upon starting, read the whole database into memory? All clients that access the database access the one in memory. Any modifications are done by the server to the database, if successful, then to the database in memory?


Robert
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11833
181
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

It sounds like you are proposing a cache for the data - something that many candidates implement, and it certainly doesnt seem to cause loss of marks.

It has been suggested (from memory by Max Habibi) that a cache could be implied in the instructions - the fact that the read method (amongst others) does not throw InterruptedException would work well with in a cached environment (you can have your constructor populate the cache, and the constructor can throw any Exception you like). That still leaves the problem of the update method but nobody said that everything was going to be easy .

However when implementing a cache you need to consider how many records you can hold in memory / what happens if you run out of memory (this is easily answered, but I am leaving that to you).

Whatever you decide, you need to document your design decisions.

Regards, Andrew
 
Tom Henricksen
Author
Ranch Hand
Posts: 136
Eclipse IDE jQuery Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I am working on the B&S Assignment. I currently read all my Contractors in the constructor. I noticed in the Exam Cram book they have a getData method and Max's book has a getDvds(). What are the pros and cons of doing it separately? I guess I thought that since I didn't have a getData method in my interface that I should read all data in in the constructor. That was probably a bad assumption.
Thanks,
Tom
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic