SCJP 1.4, SCJD
Originally posted by mike acre:
When booking a room fails it is because the record data you hold at the client end does not match up with the record data at the server end during a call to book()
ie
lock > read > matches? yes > modify > unlock
if(matches == no) then you can throw an Exception.
are people differentiating between the two subsets of this condition
1/ room now booked
2/ other room data modified. (eg smoking to non-smoking)
Obviously it is a good idea to do this.
I have a business object that is queried, not a String[].
I have implemented equals & hashCode for the initial check, but I need a little more info. hey ho, more code...
Just wanted a discussion of this area of business logic.
I'm working on design of this area at present and my opinion is when the user picks a row out of the table to book, the client should send the current value to the server and request that the server do the booking. If the client's version of the record differs from the server's version a response that includes the server version should be returned to the client with an indication that the booking failed
and the user should be given the option to retry or cancel the booking.
Whether the record is locked at this point is something I'm still debating. If you lock it, you must worry about a locked record when a client goes away. If you don't lock it all locking only lasts as long as one client transaction.
but there is a possibility that this sequence could repeat indefinitely
SCJP 1.4, SCJD
Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Originally posted by Anton Golovin:
I think that if it does not match, the only way it may fail to match is if the record was booked prior. There is no option in the program to change an extant record other than the booking customer ID.
SCJP 1.4, SCJD
Originally posted by Anton Golovin:
I think that if it does not match, the only way it may fail to match is if the record was booked prior. There is no option in the program to change an extant record other than the booking customer ID.
Originally posted by mike acre:
Howdy Peter!
I don't see that this would happen. Perhaps you need to explain your last paragraph more carefully.
Have a look at my other recent thread, also in the same area of the design.
Cheers Peter!
SCJP 1.4, SCJD
Originally posted by mike acre:
Hi Jashua,
The 48 hour rule is probably best implemented by using SimpleDateFormat to parse the Date, then subtracting the current Date.getTime() from it.
Where you do it is more open to opinion. Personally, being in the thin client camp, I have a Record object that wraps the row data and applies this rule before exporting to client. However I'm far from convinced this is the best place for it so would like opinions. I'm sure I need it within some form of 'transfer object' since the client, even though it is thin, needs to do some business checking to maintain the advantages of being thin, ie not having to make a network call to determine if the record is bookable.
So a thin client must know what records are potentially bookable and so must have some business knowledge.
If you are a fat client this is likely unhelpful.
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|