So thinking overnight and today about the design of my URLyBird project, I came with following conclusions :
- I am going to use 'thin' client, because I don't want client himself to deal with locking/unlocking, I believe server code should contain all the business logic
- I am going to have my Data class implement DB interface given by instructions which will use Facade that has LockingManager(will implements lock/unlock) and DataAccessManager(will implement create/read/update/find).
- On top of Data class I will have my business layer, probably a class called URLyBird (I have to think of better name probably, and also a class/interface design to incorporate RMI) what would implement all business logic and also have connectors for local and remove (RMI) access.
- My instructions tell me that users should have capability of searching through records and booking them. I cannot find any place where it says that users should be able to unbook the rooms. Thus I am thinking that my business object should contain only 3 methods : one for retrieving room records, one for booking a room, and another one for searching through rooms.
- If the room was booked in between the user checking for availability (refreshing table) and booking - its his/her problem, good luck next time.
- GUI will have buttons for searching, refreshing room records list (JTable) and booking. There will be also menu items duplicating these functionalities. Buttons will be located on top of JTable as a toolbar. I have to go over Swing tutorial for better design, I am not yet done with thinking how GUI will exactly look.
Any suggestions or comments?
I noticed that GUI does not require creation or deletion of room records, does this mean that create and delete methods of interface will never be called? Did anyone have a case like this in his/her project?
And also what are general strategies to overcome exception restrictions(no IOException for example) put by DB interface? I tried to search the forum but did not find anything.
A few remarks/comments:
- my business service has just 2 methods: one to search for rooms and one to book a room.
- when a CSR tries to book a room, which is already booked by another CSR, the CSR will get an error message to inform him the room is already booked
- my gui has buttons for searching and booking, my menu has just an "exit" item.
- create/delete methods are not called in the application (my test cases call them to test if they were implemented correctly)
- i created a runtime exception (DBException) which wraps the possible IOExceptions.
That's also a good idea my friend, makes implementation one step easier
I am also thinking of having an extra field for each record indicating if it is "AVAILABLE" or "BOOKED", what do you think of that? I agree that you can look at 'owner' field and if it is empty it means it is available, but this I think will make it more user friendly, won't it?
An empty field means available, a field with a customer id means booked. How much easier can it get? In my application when you select a room in the JTable which has already a customer id (so the room is booked), the book-button is disabled. So adding another extra field has no added value in my opinion
Roel De Nijs wrote:An empty field means available, a field with a customer id means booked. How much easier can it get? In my application when you select a room in the JTable which has already a customer id (so the room is booked), the book-button is disabled. So adding another extra field has no added value in my opinion
I've read and agree that it is a good practice to declare your class variables' default values even though you know what they are. For exampe:
Thus in similar fashion I believe it would be nice practice to explicitly indicate the availability. But maybe that's just me