checking for available records for booking
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi
My assignment B&S says that a record can be booked when the owner field is empty.
where do we have to check whether the owner field is empty or not at the
client side or server side
Currently I am checking this in the business method (bookContractor)at the server side:
pseudocode
bookContractor(customer id, recordNumber) throws SecurityException{
1. if( isBooked() )throw SecurityException;
2. lock
3. read record
4. update
5. unlock
}
Or should we just check this at the GUI layer(client side) by getting the owner id from the TableModel and prevent the calling of business method bookContractor.
How did you approach this?
[ May 07, 2008: Message edited by: Mary John ]
My assignment B&S says that a record can be booked when the owner field is empty.
where do we have to check whether the owner field is empty or not at the
client side or server side
Currently I am checking this in the business method (bookContractor)at the server side:
pseudocode
bookContractor(customer id, recordNumber) throws SecurityException{
1. if( isBooked() )throw SecurityException;
2. lock
3. read record
4. update
5. unlock
}
Or should we just check this at the GUI layer(client side) by getting the owner id from the TableModel and prevent the calling of business method bookContractor.
How did you approach this?
[ May 07, 2008: Message edited by: Mary John ]
SCJP 5.0<br />SCJD working on it
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Howdy, Mary. Long time no talk!
I think the best approach is to check both on the GUI and in the business layer. That's what I did.
I think the best approach is to check both on the GUI and in the business layer. That's what I did.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
posted 17 years ago
I just decided to check only at the server side, because that's the only place you can be sure that the record is up to date.
And one check seems enough to me. There is a small risk that the user is so stupid to select a record of which it is clear that it is already booked, and in this case we have some network traffic that could have been avoided. Not a big problem, I think.
Rinke
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by Mary John:
where do we have to check whether the owner field is empty or not at the
client side or server side
I just decided to check only at the server side, because that's the only place you can be sure that the record is up to date.
And one check seems enough to me. There is a small risk that the user is so stupid to select a record of which it is clear that it is already booked, and in this case we have some network traffic that could have been avoided. Not a big problem, I think.
Rinke
_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
Mary John
Ranch Hand
Posts: 109
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks Roberto, Rinke.
So I guess its just a choice to go with what you think is right. I think
doing this at the server side is anyway essential, doing this at the GUI can be just an extra check with which we can prevent unnecessary network traffic of calling and reading the datafile.
So I guess its just a choice to go with what you think is right. I think
doing this at the server side is anyway essential, doing this at the GUI can be just an extra check with which we can prevent unnecessary network traffic of calling and reading the datafile.
SCJP 5.0<br />SCJD working on it
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I think the best place to check this is in the business layer. This is an operation to be executed in the business layer, not in the persistence layer. Everything must be handled correctly before it achieves the server. If you implement your business method correctly (locking a record, then checking if it is still available for booking), then there's no need to check it in the server side (which I think is wrong).
That's how I did, and I think I reached a very clean design, which junior developers won't have any big work to understand.
That's my opinion. I'm already done with the code, so now I have to work on the documentation. It's thursday 11:59PM here in Brazil now, so I hope you guys have a good night, and I'll stay here "having fun" with the documentation!
That's how I did, and I think I reached a very clean design, which junior developers won't have any big work to understand.
That's my opinion. I'm already done with the code, so now I have to work on the documentation. It's thursday 11:59PM here in Brazil now, so I hope you guys have a good night, and I'll stay here "having fun" with the documentation!

Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Mary John
Ranch Hand
Posts: 109
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Roberto
I think I didnt make myself clear, I agree with your point of checking the
availability at the business layer. that is what I have done too. But
I suppose I am not wrong in saying that my business layer is on the server, because my client is a thin client and it is supposed to call the
business methods by RMI.
So thats why I said that the checking of availability should be done on the server side (precisely, at the business layer which is on the server)
I think I didnt make myself clear, I agree with your point of checking the
availability at the business layer. that is what I have done too. But
I suppose I am not wrong in saying that my business layer is on the server, because my client is a thin client and it is supposed to call the
business methods by RMI.
So thats why I said that the checking of availability should be done on the server side (precisely, at the business layer which is on the server)
SCJP 5.0<br />SCJD working on it
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Oh, right! You indeed said that your business layer is on the server side. It's just that I implemented my business layer on the client side.
Well, if your business layer is on the server side, than it is correct to say that this verification should be done on the server side.
[ May 09, 2008: Message edited by: Roberto Perillo ]
Well, if your business layer is on the server side, than it is correct to say that this verification should be done on the server side.
[ May 09, 2008: Message edited by: Roberto Perillo ]
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
| Does this tiny ad smell okay to you? The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








