Hi you all,
Such an open assignment is not my cup of tea. By everything i do, i have my doubts (will it be enough to pass the exam). So i read some posts on this excellent forum and more doubts come up, so reading some more posts,... and so i get in neverending circle (and that's not so good for my productivity
)
So after lots of thinking i finally started developing, but i have some doubts and questions:
1. i decided to use a randomaccessfile in each db-method (read, update, delete), so you can open and close the file when appropriate and you don't have to worry about filepointers getting wrong, because local variables are not shared. But what happens if 2 clients want to create record at the end of file or 2 clients update a different record (same record is impossible if i make a good implementation of lock and unlock methods
)? Will file contents not get mixed up, because 2 different file handlers are writing at same time? Or will second file handler throw error because it can't open file for writing (because first file handler already opened file for writing)?
2. i was planning to hard-code my db-scheme (so lengths of different fields, start position of the records section,...) because the design is available in the instructions (but also in the header and thus could be read dynamically). But i don't think that's a valid reason to mention in my choices.txt and nor is mentioning it's a lot easier then getting everything from header
What did you guys (and girls too of course) give as reason to make such a design decision?
Many thanks
Roel