I have read some posts that implement cached database. Could you tell me what's the machanism of it? Is it necessary? For my case, I always access database file (open file) whenever there is read or update. It may be time consuming and the implementation is simpler than cache database. Any opinion?
SCJP, SCJD, SCWCD, SCBCD, SCEA, SCJP6
To be obtained: SCEA 5
Hello George I haven't read the other topics about caching, but I don�t think that a cached database in this case needs to be that difficult to implement. Load all records into some in-memory collection, and then allow all the reads on it, but only write through to the file on actions that update the content. Note, that I am doing the FBN version, so this could be different in your version. The above mentioned solution could be implemented quite easily, and give you a performance increase. Weather or not performance is an issue, that is the question, then. My assignment states that I should prioritize simplicity, and create code that a junior programmer could understand, over code optimized for performance. But I think a scheme as outlined above would be simple enough. I do not think that it is necessary for the Developer assignment, however, since the scale of the application wont suffer from a bit of performance penalty. Cached or not cashed, I think both are acceptable. The important thing is to remember to describe your choice, and motivation for it, in the design decisions document. Regards, Flemming Mertz