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 ]
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
posted 18 years ago
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!
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
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