aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Completed Stand Alone Client ( DB + GUI ) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Completed Stand Alone Client ( DB + GUI )" Watch "Completed Stand Alone Client ( DB + GUI )" New topic
Author

Completed Stand Alone Client ( DB + GUI )

Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Hi!

I finally completed the DB and GUI. I have done the following, please kindly help me verify if I did anything wrongly.

Database ----
1) DB implemented all the DB.java interface
2) Implemented locking without creating a LogManager, using simple synchronized + HashMap
2) Load all records into hashmap on start. (caching)
3) read functions like find and get will get from hashmap
4) update functions like find, delete and create will update file and hashmap
5) implemented RoomDAO to communicate with data.java
<MODEL> - <RoomDAO> - < DATA >
6) Test my Code with Roberto's Data Class Test and set loop to 100times with no problem ( I do no not need to click terminate - red square)

GUI
1) Implemented MVC
2) Implemented Observerable on Model and Observer on view
3) implemented the following functions all on 1 panel
   a) delete hotel room
   b) book record room (update customer id)
   c) view all records
   d) search (hotel name && location) unless null. meaning hotel name and location must match start of string, or only hotel or only name(depending if user leave any fields empty)
   e) did not implement create room or unbook room function
4) extends JPanel, JTable, JFrame .. not sure if it will violate "must be composed exclusively with components from Java Foundation classes(Swing components)
They are from javax.swing.*

Please let me know if you feel anything is wrong. Thanks!

Need help with the following

1) read up on RMI (Server and client)
2) is there a simple logger class I can use? I hate declaring logger = bah bah all over again.
3) My eclipse doesn't end all launches after I click exit or even the stop icon. Is there something wrong with my code? I have to press x or xx to clear launches
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5402
    
  13

a) delete hotel room
e) did not implement create room or unbook room function

Why would you implement "delete room" but not "unbook room", "create room",... That makes no sense at all. Just limit the application to the requirements (book and find) or make sure it makes sense, like "book + unbook", "delete, create + update",...

d) search (hotel name && location) unless null. meaning hotel name and location must match if they are both provided.

You must allow search based on name and/or location (according to instructions), so just hotel name && location will not be enough. It's indeed correct that when a value is provided you only want to see exact matches.

4) extends JPanel, JTable, JFrame .. not sure if it will violate "must be composed exclusively with components from Java Foundation classes(Swing components)

Which package are these classes in? That rule just indicates that you must use classes from the javax.swing package and that you are only allowed to use components from the java.awt package if there is no Swing-alternative (so don't use a TextField, but use JTextField instead)

1) read up on RMI

Sun's (nowadays Oracle's) RMI tutorial would be a good starting point

2) is there a simple logger class I can use? I hate declaring logger = bah bah all over again.

You are not allowed to add extra dependencies to your project except for the JDK, which means logging should be done using classes in the java.util.logging package

3) My eclipse doesn't end all launches after I click exit or even the stop icon. Is there something wrong with my code? I have to press x or xx to clear launches

Have you already tried Roberto's Data Class Test (see ScjdFaq) to make sure your Data class is thread-safe and thus able to handle multiple concurrent requests. If you have to clear launches by pressing x multiple times, that's not normal and indicates one or more bugs into your program in the locking (and unlocking) section of your application


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

Joined: Jul 17, 2011
Posts: 160
I tested it with modification. I have updated my first thread with all the answers to your questions except first on deletion function( I need to sleep over it) heehee

Please let me know if you found any fault with my implementation, I don't wish to fail


Modify Codes, I remove the deletion to prevent RecordNotFoundException when updating record 1
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5402
    
  13

1/ May I ask how much experience you have with software development? I assume it's very limited

2/ You don't edit your post to give answers to questions/remarks I made in a reply. For someone else to read this thread, it's not convenient at all. And it makes me look like a fool, because I'm asking questions which are already answered in the post I'm replying to.

3/ Getting rid of the deletion of record 1 in Roberto's Data Class Test is completely useless! Because you have removed one of the key features of the test and your program must be able to handle an update of a record which was just deleted. So by deleting this code you made the complete test redundant. You only need to do some small adjustments to make the class talk to your Data class, not delete complete chunks from the test. It's even better if you would add an extra thread which deletes a random record (like the random record update). To have full benefit of the test you have to make sure the delete and update method concur with each other to update/delete the same record. That's how you will spot an issue with your locking mechanism.
Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
1) Yes, I am quite new to software development. I am trying to complete this course, sorry.

2) Opps sorry, I am just worried others might ask the same question and not read the entire thread. It happens a lot from the forum I use to visit.

3) The delete works, and it will throw RecordNotFoundException, but imagine if I have the delete thread, since the first record has already been deleted in the first run, whats the point of updating and deleting record 1 over and over again and all you get is RecordNotFoundException.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5402
    
  13

That you are new in software development is not a problem: everybody has to learn (I have 7 years experience in Java development and I'm still learning each day). That you don't show any effort at all, worries me a lot. Certainly if you want to become a developer. You don't have the reflex to have a look at the API if you are unsure about a class or a method, you ask for an example of a utility class (instead of using the internet or trying it yourself),... And if you don't show the effort, I'll stop making the effort in replying your questions because if you don't show any effort why would I go to all that trouble (I'm spending my free time voluntary to answer your questions).

I am just worried others might ask the same question and not read the entire thread.

If others are not willing to read the whole thread, they don't deserve to know the answer. That's again the ShowSomeEffort device

The delete works, and it will throw RecordNotFoundException, but imagine if I have the delete thread, since the first record has already been deleted in the first run, whats the point of updating and deleting record 1 over and over again and all you get is RecordNotFoundException.

The delete should not throw the RNFE in my opinion, it's the lock-method that should throw the RNFE. Your Data class must be thread-safe (the hardest part of the assignment by far) and thus must be able to handle multiple requests. If your locking mechanism is not well implemented the scenario of updating a deleted record will result in a thread waiting forever (and thus will make you fail the assignment). That's why that part is so important!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Completed Stand Alone Client ( DB + GUI )