Hi all First of all, if i violate any of the JavaRanch policies by dropping my Data.java's constructor and also my read() method for your advice and tips, pls remove appropriately and i apologise; but i just wanna know if my read() is on track and appropriate! I use a cache:
I dont know if this procedure is sufficient for a read() method? Also i dont know if my Data.java constructor is appropriate? Thanks! :roll:
[Andrew: removed code that is irrelevant to the discussion] [ December 30, 2005: Message edited by: Andrew Monkhouse ]
First of all, if i violate any of the JavaRanch policies by dropping my Data.java's constructor and also my read() method for your advice and tips, pls remove appropriately and i apologise;
This is dangerously close to having all code removed, however I have decided to leave it for now.
I think you have far too much code posted for getting many comments - it just becomes too much for others to read and make comments on. You would be better breaking it down to smaller sections. While I got rid of many methods and variables that were not germaine to your desired discussion on the read() methods and the constructor, it could have been pared down even further. Probably it would have been best to have a post that only discussed the constructor (and only had those methods and variables necessary for that discussion), then another post that only discussed the read method with a comment that global variables are initialized in the constructor (possibly with a pointer back to the original thread).
I don't think there is much value in having both a Javadoc comment and an inline comment:Speaking of dbName - why is it a global variable? Do you use it outside of the constructor and it's associated openDataFile() method?
Your read() method has a very small window of oportunity for a record to be deleted between the validation of the record and the conversion back into a String.
Hi Thanks Ali Hussein and Andrew for your insights! I apologise and would make necessary adjustment to posts i send next time! I see your point about the dbName, it's best made a local variable! I also see your point as regards the read()! I will look thru it again! I have modified the code to have a method to check for the validity of the file now! Thanks for your input!