I'm curious on my assignment (URLyBird 1.2.2) on the way how yoy guys handle the booking/unbooking of rooms.
I wonder which input do you request from the user when booking a room besides the 8 digit customer id. Do you for example ask the user to input the number of accommodations for the room?
And if you do, I wonder how you handle tihe unbooking of a room? When a room is booked lets say for 5 days, when do you let the user unbook the room? The booking period might be shorter, longer than requested. How do cope with it?
when user selects a room from the table (and that room isn't booked already) and clicks the book button, a dialog is shown which requires a valid customer id. When the user confirms this dialog (click ok button), the booking process starts (locking the record, checking if no other client already booked that room,...).
Axel Leucht wrote:Do I understand you correctly that once you booked a room you can't book it again (and it stay booked forever) as it is now booked?
I reread my assignment and indeed the unbooking method isn't required, but this seems to be weird to me, isn't it?
Hi Axel, the assignment really requires the book and search methods. Once a room is booked, it is booked. You may provide a unbook method for the client UI but that's not necessary. If you asked about the book method, you may also wondering what about the delete method (like once a room is created, can I delete it).
In my implementation of UB I provided book/unbook, search, create/delete methods. Again the delete method is not necessary. Now regarding your earlier post about when to you allow a room to unbook itself... I did mine as anytime. Meaning once I book it, I can immediately unbook it. You may noticed the 48-hour window for booking rooms. I used this info to set the date also. Some people just ignore the date when booking rooms.
The assignment is more than complicated enough, so I did only what was required:
only find and book available from the gui
my data class has implementation for all methods (create, delete, read, update,...), but only a few (read, find, update, lock,...) are invoked somewhere in the program.
did nothing with the 48 hours rule, except mentioning it in the choices.txt why i didn't handle it.
So you can now implement unbook functionality and do a lot of thinking about it, with some rules. And then the business guys come up with a whole other set of rules for unbooking a room, so all your work will be gc'ed
They asked for finding rooms and booking a room, so that's what they got. And indeed it's a bit weird, but you won't get any extra credit/points for doing more than what's expected, you may even lose some points...