I am in the analysis phase of the assignment and I'm stuck. Please forgive me if these questions are just plain dumb. I am missing some concept here as I cannot work out the significance of two statements in the assignment:
1/ 1 byte flag for deleted records Under what circumstances are the records marked as deleted? When a room is completely unavailable for use?
2/ customer id - if this field is all blanks the record is available for sale In the data file supplied all rows have dates in the past and the customer id's are blank - this gives me the impression that the rows already in the datafile are to be reused - change the date and customer for each new booking.
I understand the Spec could have been word ambiguously intentionally to allow for choices, so is it OK to ignore thse two statements and create a new record for each new booking?
In the case of point 2 would be ok to delete the newly created row if a customer cancels a booking (that is assumming a new row was created on taking a new booking)?
Joined: Mar 23, 2006
I will correct myself - the file must be populated in exactly the same way it was before to enable a legacy reporting system to correctly interact with the data file.
So it is not an option to change how the data is used and adapt it to any new usage. I will need to understand exactly what the two points (above) mean.
1) The assignment requires us to implement the DBMain or DBAccess interface depending on your assignment.
I think you need to think of this class of implementing database like functionality, in that you can create, read, update and delete. (Although all this functionality may not be used by our GUI!)
The purpose of the deleted flag is to provide an optimised mechanism for deleting records. As we are using a flat file it would require a complicated process to remove a record i.e number of bytes from the middle of a file.
Therefore by using a flag to mark the record as deleted we do not reduce the size of the file, but when we need to create a new record we can reuse the space in the file that is marked as deleted.
Also when we read records we ignore records that are marked as deleted.
2) The customer id field is used to determine if the room is available, if the field is empty you can book the room otherwise it's already booked.
You shouldn't modify the date, only the customer id field when the room is booked.
You need to remember that there maybe other applications (read your requirements) that may add new rooms, the application you are writing is for the agents to book the rooms.
Hope my explaination helps
Joined: Mar 23, 2006
Thank you for taking the time to help me with this query, it is appreciated.
I think your suggestion of just implementing the interface methods and only calling methods relevent to the assignment is a good idea. As a result, I am happy to just implement the mehtod to mark a record as deleted, although I may completely rewrite this row when creating a new booking. I don't expect to use the delete method in my assignment! What do you think?
About the blanking of customer id's. Can you (or someone) please confirm why customer id's would be blank: Cutomer makes a booking then cancels booking. Rather then Delete the entire record, the customer is simply blanked out. I can accept this is file optmisation feature, the record is then available for rebooking if a new customer's requirements matches.
Joined: Dec 04, 2001
Just to clarify, I meant that you should implement all the methods defined by the interface even though you may not use every method currently in your GUI.
You will need to read your requirements, but I doubt you will need to use the Delete and Create methods in your assignment, although saying that I have created a simple command line utility to create/update records for unit testing purposes only (If you do this remember to back up your original db file!)
The create method should look for the first record in your file that is marked as deleted an then update all the fields when creating a new record.
The delete method should only mark the record as deleted.
The customer id should only be blank if the room has not yet been booked, i.e the room is available. When a room is booked the customer id field is updated with the customer's id.
The record should not be deleted just because it is booked, as the company will want to report on the number of rooms booked etc. I think you can assume that there would be some house keeping process to remove records that are greater than a certain period, but this is outside of the assignment.