Ok, I know from doing searches of old posts in this forum that this subject has been discussed in the past, so I apologise in advance if you've been asked your opinions on this already.
However I would like to get the opinions of any new people on the forum, and specifically people doing the Bodgitt and Scarper assignment.
I have considered both approaches, and have decided to go with JTextFields.
The main reason I decided not to use the admittedly more user-friendly JComboBox is that I think to implement it correctly, you would have to set up some sort of Observer - Observable link between the GUI and the DB, and this in my opinion goes beyond the scope of the project.
If you don�t setup this link between the GUI and the DB, the contents of the JComboBox could become stale (an existing record could be deleted, or a new record created by another user).
Another small disadvantage is that, potentially, the DB could become very large � this could lead to JComboBox�s containing massive lists of search criteria.
For these reasons I think using the JComboBox possibly could become a problem as the application grows.
The JTextField on the other hand, while not as user friendly, avoids all these problems.
The downside to the JTextField is that the user can enter search criteria that will yield results from the findByCriteria method in the Data class, but these results would violate the following requirement:
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.
(For example searching on �Fred� would yield �Fred and Nobby� from findByCriteria, but the GUI spec are such that only a search on �Fred and Nobby� should yield this result.)
Therefore an extra level of checking is introduced to filter out these �bad� results.
Again, this is all a matter of opinion, and so long as you document your reasons for your decisions either approach should be acceptable.
My choice was a JComboBox. 1) I could limit search results to 100 initially, this is documented and the number of results are also displayed to the user. I did not make it configurable as in my opinion that's overkill. I documented to that effect as well. A search using wildcard will return everything, if the user wants speed in a big database they'll narrow search. Thousands of records isn't as big a deal as people assume, load some into your database and see. Hundreds of thousands/millions sure, but thousands is nothing, and it's a small company selling rooms that would otherwise be vacant, so catering for millions of unique hotels/locations isn't a requirement.
2) I could satisfy the GUI spec, as Fred and Fred and Nobby will have been listed in the combo box, obviously unique entries only. Using the 2 combo boxes you can quickly narrow and widen your search.
3) Stale data, not a consideration as the Observer - Observable pattern is overkill. The data is checked regardless, you can't book a room already booked in the meantime, sure this has some inconvenience for the user on the odd occassion, but the day in day out convenience of 2 drop downs will have outweighed this in my opinion.