aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes My overall design choice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "My overall design choice" Watch "My overall design choice" New topic
Author

My overall design choice

Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

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.

Personal page, SCJP 6 with 91%, SCWCD 5 with 84%, OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

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.

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

Thanks for remarks!

Roel De Nijs wrote:
- my business service has just 2 methods: one to search for rooms and one to book a room.


How did you retrieve all the records in the beginning then? By making a search request with all parameters null?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

I didn't retrieve all records at the beginning (and I documented in choices.txt why I decided not to load records at startup) But your suggestion is certainly a possibility.
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

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?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

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
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

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:



instead of



Thus in similar fashion I believe it would be nice practice to explicitly indicate the availability. But maybe that's just me
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

Elchin Asgarli wrote:I believe it would be nice practice to explicitly indicate the availability

Just do it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My overall design choice
 
Similar Threads
Confused by the URLyBird
URLybird
URLyBird Requirements
Misc URLyBird questions not covered in the assignment instructions
URLyBird - Initial thoughts / doubts