This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hey! There's a lot of threads about that rule but I want to tell You my approach (fable is the price
So, they takes bookings only within 48 hours, and they sell accomodations for business and pleasure travelers at short notice.
In db schema I see 2 fields per record: Price per night (Charge per night for the room) and Date available (The single night to which this record relates)
Try to imagine such scenario:
24/OCT/2008 22:40 (Friday night... )
What can You do at Friday night? 1st option: go with friends and drink some beer, 2nd option: try to finish SCJD...
Let say You we choose 1st, at some point we have to find place to sleep or where we can continue party. We were lucky, because one our friend has phone to UrlyBird, that company "sell accommodations for business and pleasure travellers at short notice." Sounds good, ok it's late (22:40) and they take bookings only before midnight (also hotel's receptions does not work after midnight). So lets hurry up! Quick call to UrlyBird ...
[Jessica] Hello.. [We] Hi, we are looking for nice room were we can move our party, do You have any? [Jessica] Hmm let me check, searching... Yup I found one room available today ('2008/10/24') hotel 'President' do You want it? [We] Sure! [Jessica] Wait a sec., let me make a booking. Done, but hurry up, You have to be there before midnight, in other case janitor will not let You come in. [We] Thanks!
So they have it, and they can continue their party for whole long night
That scenario helped me to understand and implement 48 hr rule:
-If '2008/10/24' is availability date 'The single night to which this record relates' then client can book room before midnight (also hotels accept that hour)
So I can book room before 2008/10/24 23:59:59 but after 2008/10/22 23:59:59. So there is exactly 48 hours
I'm taking '2008/10/24' which is 2008/10/24 00:00:00 and the rule is:
I think that match perfectly with my scenario, and also it adhere to hotel business rules.
What do You think?
Ouch it's Friday night... I'm going to get some beer .... [ October 24, 2008: Message edited by: Sebastian Puzon ]