This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Jianping Wang

Ranch Hand
+ Follow
since May 29, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jianping Wang

The extra effort you made makes you extraordinary. Everyone has potential to use his "extra" power, but few people does that.

To "Extra Effort"!
What's in your mind when you were preparing SCJD and passed it with 100% ?
Roel?
I am curious about the motivation behind it.

[Devaka: Edited the post to be more generic]
I recently bought the HeadFirst Design Pattern and SCJD (authored by Monkhouse) and read them carefully. My question is about the model part of MVC. Because JTable has a model, and the M(odel) in MVC is also a model. Should we keep the JTable model in the big Model or keep it in the View? I can see the advantage of keep JTable model in View because when I select a record, I can disable or enable buttons by getting information from JTable model.
put intefaces and implements in separate packages. Is this the right decision? The reason for this is I want client only know interfaces, and completely eliminate the possibility of client accessing server side classes.
That's a safe and accurate way!!!

Thank you.

Network Approaches
Your choice of RMI or serialized objects will not affect your grade, but no other approach is acceptable. In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely. No authentication is required for database access.


I am confused by the key word database here . It means server or just the data file?
So I only include name and location in search section of client GUI.

It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.


The "exactly match" seems more restrict than "start with". Should I ignore "exactly match" and adopt "start with" instead?
findByCriteria takes an array of String. While some data are not String, they may be numeric, like size or money, so the search result may not be what we want. For example, client want a room low that $30, what we return are anything begining with "$30" such as $300, $302..

So I can just show the String field and hide numeric and other fields in search panel? Or be complex, introduce two-stage criteria search: return all matches that meet string criteria, and then in business layer, filter out those not meet numeric criteria?

I don't know on what condition will the DuplicateKeyException be thrown. because this method is synchronized and the recNo is allocated inside this method.

Roel De Nijs wrote:Here you'll find more info about the approach I used.


Your solution is surprisingly simple. I have a RoomServices with 5 methods: find, findByExample, add, remove, book. You have only two, find and book!!!

In MVC, I will choose a different aproach: view doesn't know controller, while controller knows view. Example likes this. To me it is more intuitive: controller forces listener(spy ) into view, when view takes any actions, listener will feedback to controller and controller will take some actions according to it interest.
Read this official article and you will get a clear idea. Better try the example.
http://java.sun.com/developer/technicalArticles/javase/mvc/
So you guys use the modified MVC (controller becomes mediator) or original one (in this case model and view sync with each other)?
It really just confuses me. Controller and Model? So If Controller means actions and Model means data, why not combine them together as ActionRepository?
I just download netbean 6.9 and found this disclaimer:


Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned...



I did not start learning Swing and its time is over!