Well, the question is on the purchasing of Fly by Night tickets. Which of the 2 protocols is better. If you think they are both poor, please advice. Protocol 1. 1-lock 2-check if tickets are available 3-unlock 4-ask client if he still wants tickets 5-lock 6-buy tickets if still possible 7-unlock Protocol 2. 1-lock 2-buy tickets if possible 3-unlock 4-ask client if still ok 5-lock 6-rollback if client refuses 7-unlock I dont like protocol 2 because of the possibility of session break after step 3 . I dont like in session 1 the enventuality that ticket may be sold out at step 5 but I think this protocol is better . Thanks Charles.
My plan is to ask the user if they are sure they want to purchase the tickets before any interactions with the server occur. 1. Select a list of flights from the server. 2. Display results in a JTable 3. User asks for X seats on flight Y 4. Validate that there are X seats available on flight Y by checking the currently displayed flight information. I know this may be stale data, but I feel it is okay. 5. Ask user if they are sure. 6. If yes, call the researveFlight(X,Y) method of the DataFacade. That's it! The Facade will handle the locking and unlocking, and any other business logic. --Dave.
Hi, I'd advise you to keep things simple. This is not a real-world app. You simply have to prove your ability to implement a simple booking. I've heard that people got deductions because they did too much. Here's what I did (and passed): A table displays all flights and the available number of seats (at the time of loading the data). The user double-clicks the flight (or presses a button, which is enabled when a flight is selected, or presses a short-cut for booking), and a small window pops up, containing all of the flight. In addition the window has a widget for entering the number of flights to book. And then the user may click the buttons "ok" or "cancel". "Ok" called the book() method, and this is what it did:
lock the record
get the record from the database
when enough seats are available, adjust number of available seats, write record back to the database, and asynchronously inform the user that the booking was successful
when the number of available seats is less than the booked seats, inform the user that there are not enough seats available (also asynchronously)
The intended group of users is not the general public, but the employees of the travel agency. This means, implementing this kind of "Do you really want to..." popups is overkill. [ November 11, 2002: Message edited by: Mag Hoehme ]