• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What do you think about my approach to solve the mismatch between find() and gui requirement?

 
oli mueller
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

as most of you know, Sun has given us something to think about, when they defined the GUI-requirements to find rooms in URLYBird.

my GUI 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"

(1)
Having seen a lot of interpretations of this sentence, my first question is. Would you agree that this clearly defines that the user must be able to
- search all rooms
- search for rooms which equal a specified name (not caring about location or anything else)
- search for rooms which equal a specified location (not caring about name or anything else)
- search for rooms which equal a specified name AND a specified location
- search for rooms which equal a specified name OR a specified location

So far, so good...now as discussed in a lot of threads, the find()-method in the DB-interface works based on startsWith, so my business layer must do a bit of extra filtering. Additionally, the find()-method does not distinguish between And and OR.

(2)
What is your opinion about this: I have interpreted the javadoc of find() such, that a record only goes into the result-set if ALL non-null criteria fields match the corresponding record field (implicit And-logic). Actually I have seen, that Roel De Nijs interprets the sentence just the other way (a record goes into the result set, if at least one criteria matches (implicit or)) - I would love to follow this approach, because it makes the filtering in the business layer much faster and simpler...HOWEVER, personally I see no way how the javadocs can be interpreted this way..lol...the javadoc says "returns an array of record numbers that match the specified criteria" --> it does not say that a returned record is allowed to match just a subset of the specified criteria...for example if the DB contains
(1) Palace Berlin
(2) Palace new york
and you invoke find() with ["Palace", "Berlin", null ...], my approach returns just the first record, whereas the other approach returns both records, but does [Palace, New York] really match the specified criteria(=Palace, = Berlin)?!...I would be glad, if you had a good argument for Roels approach, as I would like to follow it, too (see next item)...lol


(3)
Now, because of this interpretation, i obviously have a problem because my filtering algorithm in the business layer...because IF the user chose "name=Palace" OR "location=Berlin", my implementation of find() simply returns not all records that potentially really match the user`s query. I solved it by just ALWAYS calling find with a all critiria set to NULL. Hence, find() returns all records, and i can filter on them...do you think, this is a valid approach??...i know, it is maybe not as performant and if i would implement the find()-method with implicit OR-logic, the filtering would have to work on a much smaller set of records, but i am just unsure whether or not it is ok to interpret the javadocs this way....stupid java docs...lol

ANYWAY...thanks for your feedback.
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oli mueller wrote:
(1)
Having seen a lot of interpretations of this sentence, my first question is. Would you agree that this clearly defines that the user must be able to
- search all rooms
- search for rooms which equal a specified name (not caring about location or anything else)
- search for rooms which equal a specified location (not caring about name or anything else)
- search for rooms which equal a specified name AND a specified location
- search for rooms which equal a specified name OR a specified location

I gave it the full boolean interpretation, yes.

(2)
What is your opinion about this: I have interpreted the javadoc of find() such, that a record only goes into the result-set if ALL non-null criteria fields match the corresponding record field (implicit And-logic). Actually I have seen, that Roel De Nijs interprets the sentence just the other way (a record goes into the result set, if at least one criteria matches (implicit or)) - I would love to follow this approach, because it makes the filtering in the business layer much faster and simpler...HOWEVER, personally I see no way how the javadocs can be interpreted this way..lol...the javadoc says "returns an array of record numbers that match the specified criteria"

If you were the casting director for The Sound of Music and you had to find actors to play the children, how would you interpret this instruction?

"Return a list of child actors who look just like the von Trapp kids."

A. Would you only include an actor who looked like each and every one of the von Trapp kids?
B. Or would you include any actor who looked like at least one of the von Trapp kids?

Which would cause the film's producer to fire you: (A) or (B)? ;)

Like Roel, I interpreted the requirement broadly and inclusively (implicit inclusive OR). In support of this reading, one might point to the fact that the fuzzy matching in the data tier is also inclusive in its apparent intention.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because my name is mentioned a few times in this topic I can not let this one go by without answering

In my GUI a user can have 4 different searches:
- all rooms
- rooms with specified name
- rooms with specified location
- rooms with specified name and location
So I don't have "name or location". I interpreted the sentence slightly different But that's where this assignment is about: interpretation of a set of instructions, implementing an application and defending/justifying your decisions in a document.

oli mueller wrote:the javadoc says "returns an array of record numbers that match the specified criteria"

Again this sentence leaves (in my opinion) room for interpretation. I interpreted this sentence as "a record is a match if one of the fields matches the corresponding criterium". This interpretation does not violate the given javadoc. I define a match as "one of the specified criteria". It would be a different story if the javadoc would say "returns an array of record numbers that match all the specified criteria". It's completely fine that you have another interpretation of this sentence and you just have to document your decision in choices.txt and you'll be fine too (because you are not violating any must requirement). Don't forget also to address (and give solutions) of possible drawbacks of your workaround (e.g. when using a fat client your solution may have performance issues with big database files: all records are sent over the network, while you needed just 5 records).

And to end my post. You asked a good argument for my approach, I'll give you one: I passed with a perfect score So I guess the approach I took is a valid one (if you justify it correctly of course)
 
oli mueller
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for the quick reply......

....i think, having read your good arguments, I am leaning towards implementing the find() with an implicit OR, thereby making the filtering in the business layer working much more efficient...

THANKS a lot and my compliments to a very good+helpful forum...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic