Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bookSeat() on clientside or serverside?

 
Bruce Ichiban
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think i know the answer to this one, but then again, im not sure, so i wanted to check with everyone just in case...
where should the processing/controller logic for say booking a seat take place?
option A:
put all the "logic" in the code on the client side, where the client locks records, modifies records, unlocks records, etc
or
option B:
make a method bookSeat() that gets processed on the server side. all the client knows is whether the booking was successful or not.
ideally i think option B is better in terms of separation of work. the client shouldnt know about the database and how it works. it should just know it wants to do and requests that the work gets done.
however, on the other side of the card, why would the requirements require that the client implement the same public methods as the Data class? why force the providing of methods like lock() and add(), etc to the client if its not necessary?
am i just second guessing myself? (i tend to do that! heheh)
thanks for your help
[ January 29, 2002: Message edited by: Bruce Ichiban ]
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I had designed my seat booking method on server side with a seperate LockManager class which handles record locking. If you are using the seatBooking() method on the client side than you have to use Singleton Pattern.
Regards
Anurag Mishra
 
Bruce Ichiban
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, i have a lockmanager on the server side, but should i have a method on the client side that makes all the separate calls to lock, delete, unlock for example instead of having a method that gets executed in the server side, where the individual calls are made.
overall design wise, i think the 2nd way is preferable, but im second guessing myself since the methods are accessible to the client...
anyone else have some thoughts? thanks!
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bruce/Anuraj,
The user must be able to book one or more seats on a chosen flight. If the flight cannot provide those seats, the user must be informed.
So , how do i know which user has booked on what flight. Does one need to store this data ?What is the best place to store the booking data ?
Or do i just decrease the available seats on a flight and that's it.
Regards
Suchak Jani
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well. You do need to decrease the available seats in the db.db file when someone books a flight. However, you don't need to save any information as to who booked what, when or how.
So if a client tries to book 10 seats and there are only 8 left, you have something pops up that says. Sorry, I cannot complete your reservation, there are not enough seats.
If you try to book 2 seats and there are 10 left, then you pop up a message that says "Congratulations you have been booked" then change the db.db file to say 8 seats left.
Mark
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
That makes the database much simpler.
Thanks!
Regards
Suchak Jani
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic