Hey, champion!
Do you guys read the magic cookie every single time before reading-from/writing-to the database file, or only once?
No, it isn't necessary. This code has just to be verified when the database file is accessed for the first time. In fact, some developers choose to ignore it!
and then after checking if the magic cookie corresponds to the one hard-coded, do you store the true/false in a static variable so that all instances of the class shares it?
It also isn't necessary. You just verify this number for the first time the file is accessed.
I also decided to use the facade design pattern where I have the Data class and then two other worker classes; now: did you guys read the "offset to first record" and "magic cookie" from the database worker class, or another util class?
Hum... I'm not sure if I got your question, but here's what I did regarding the offset of each record: I have a formula that calculates the postion of a given record, given the size of the magic cookie, the headers of the file, etc.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD