Pawel Pawlowicz wrote:That's what I am doing.
I implemented find() using AND approach. A record is added to results when and only when all fields matches the criteria.
As find() method in Sun's interface matches using startsWith() and GUI should display only records that exactly matches, I extended Sun's interface and added method findExact().
So I don't need to filter any results in GUI nor buisness layer. I also don't have to worry whether there were any modifications to the database between find() being executed and filtering.
For the GUI. I have two text fields. One for name and one for location.
If both are blank then I return all records.
If one of them is blank I return records that exactly match a criterion in the other.
If both are filled I return records that match both of the criteria exactly.
What do you think?
Glad to see that we are on the same page. My approach almost exactly match yours, and in my opinion it should be fine. Well, we'll find out soon, because I'm going to submit my app in about 10 days.
The only difference is that I use just the original find method (which returns records using the AND approach) and then I do the filtering in the service layer for exact match when is the case.
In my GUI I have separate 'Exact match' checkbox for each field, so the user can search let's say for a name starting with something and a city which exactly match the user input. - But this flexibility is beyond the requirement.
Joined: Nov 27, 2013
Just removed the duplicate reply. - It seems that there is no way to delete a post.
Roland Kozma wrote:Because these seams contradictory I think that returning just the records which match all the criteria (using AND) should be a valid interpretation too.
Have you heard that somebody failed because of this interpretation?
Until I stumbled in this subject on the forum I had no doubt that we should use AND to match all the provided criteria.
Pawel Pawlowicz wrote:What do you think?
About the implementation of the find-method and if you should "AND" or "OR" the criteria is one of the most discussed topics in this forum. And in this discussion there is no right or wrong. This is just one of the many ambiguous requirements in the assignment which make you think and make a decision. You can elaborate a bit about your decision in the decisions document (choices.txt) and you are good to go. Just note that there is a difference between the find-method implementation (starts with search) and the search needed for the front-end (exact matching). That's more important than using "AND"/"OR" or ignoring null values or not.