• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GUI Search Question

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have a quick question about the GUI's search capabilities. My instructions say:

"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."

I am assuming that the 'search the data for all records' means that the user can request all records to be displayed in the JTable and they will then visually browse through it.

Also the use of the word 'or' in saying that the GUI should allow the user to display all records and also search for records my name/location, i.e. both capabilities or does it mean implement either one exclusively?

If I was to provide both seach capabilities (get all records and search by name/location) would I be penalised for this? That is assuming I must implement either one exclusively!

Any help would be greatly appreciated.

Thanx

James.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you think it means? As long as you can justify it (in choices.txt) you wont lose marks.

Charlie
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

I took this to mean that we need to allow the user to search by criteria or return all records in the database, i.e. two search functions in the interface.

Regards,

Jon
 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi James:

"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."


I interpert the previous statement as following:
Your search method should return a collection of records where:
1) record.deleteFlage == "0";//or what ever sign is used to identify a record as active
2) record.name == theGivenName;
3) record.location == theGivenLocation;
4) (record.name == theGivenName) && (record.location == theGivenLocation);
5) (record.name == theGivenName) || (record.location == theGivenLocation);
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

This is a perfect example of an unclear specification where you have to make a choice as to how you believe it should be implemented and then document that decision. As long as it is documented, you shouldn't have a problem.

My personal reading is that you can
  • search for all records
  • search for records matching provided name
  • search for records matching provided location (the or to point 2
  • search for records matching provided name and provided location



  • The nice thing is that the language is imprecise enough to allow my interpretation. And my solution is going to be easier to implement than Hanna's (although I acknowledge that Hanna's interpretation could also be correct).

    Regards, Andrew
     
    Ranch Hand
    Posts: 823
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    "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 simplest interpretation of the above is that you either have to implement a search for all records or implement the more specific name/location search. However, I wouldn't want to take the chance of opting for that interpretation at the risk of losing marks on the usability of the application (even with justification for the design choice/cop-out).

    I think Andrew's interpretation is the most likely optimal solution as it is the kind of search capability that I've previously implemented in real-world enterprise software. Hanna's suggestion is equally valid, however, but contravenes the KISS principle (Keep It Simple, Stupid!). :-)

    I have a question related to this thread. My B&S spec asks for search functionality where the name/location EXACTLY matches the search criteria as quoted above. However, the comment description of the find() method in the DB interface states that: "A non-null value ... matches any field value that BEGINS WITH [the search string]". It also says that: "Your data access class ... MUST implement the [DB] interface", which would seem to be a bit of a waste of time given the stated user requirement. This apparent contradiction (or anomaly), while possibly intentional, makes me wonder if I should provide some basic pattern matching functionality for the user. Of course, in line with the aforementioned KISS principle, I'd rather not! :-) Any views?

    Regards

    Jules
     
    Ranch Hand
    Posts: 531
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    "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."


    It seems to mean the following:

    Your user has to be able to:

    1) download all records for browsing.
    2) download all records where name exactly matches the respective value in the record.
    3) download all records where location exactly matches the respective value in the record.
    4) download all records where name and location exactly match respective values in the record.


    Also, if you read the comments to the DB file, it says that the

    public int[] find(String[] criteria)

    method must have its criteria[n] element also match those records where a partial match can be achieved. Since the top points speak only of name and location, I take it to mean that partial matches on those values are necessary as well.

    So I am probably going to implement the following:

    x = name, y = location
    x = null - all records match on x
    y = null - all records match on y

    if y == null and x matches partially (in this respect, a complete match is just a perfect partial match, so to speak), fetch the record.
    if x == null and y matches partially (in this respect, a complete match is just a perfect partial match, so to speak), fetch the record.
    if x == null and y == null, fetch all records
    if x != null and y != null fetch only those records for which there is simultaneous partial match (could be a perfect partial match) for both x and y.

    Because you are likely going to be checking for match with some method that checks if user input matches a substring from the beginning of a record field, you don't really have to worry about writing specific code for complete matches. You should only check for partial matches, and a complete match will be a particular case in that check.

    P.S. Yep, I agree with Julian, there is a contradiction in the instructions, and this would be the perfect case for documenting the choices. I think in some cases they deliberately provide vague or contradictory directions to account for real-life requirements. In this case, though, the method signature they provided does not allow for distinguishing between allowing partial search and requiring only exact search. So based on the provided method signature and their contradictory instructions, the only way to comply with both is, we must allow partial search, and I will put exactly this reasoning into my choices.txt when destribing my implementation of the search feature vis-a-vis their instructions.
    [ August 03, 2004: Message edited by: Anton Golovin ]
     
    Ranch Hand
    Posts: 783
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    "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."


    My interpretation of this statement matches Andrew's, although I can understand how someone else could easily interpret it differently.

    Also, if you look at it from a user's point of view, it would make the most sense to be able to browse the entire database, search by name, by location, or by name and location.
     
    Greenhorn
    Posts: 25
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Julian Kennedy:

    ......
    I think Andrew's interpretation is the most likely optimal solution as it is the kind of search capability that I've previously implemented in real-world enterprise software. Hanna's suggestion is equally valid, however, but contravenes the KISS principle (Keep It Simple, Stupid!). :-)
    ......
    Jules




    I believe they are different.

    In Hanna's suggestion:
    (1) search all records,
    (2) search only records matching the given name
    (3) search only records matching the given location
    (4) search records that matching both name and location
    (5) search records that matching either ( (1) union (2) )

    In Andrew's suggestion:
    doesnt have (5).

    In specification:

    ....where the name and/or location ...... which are case (4)and (5)

    Keep it sophisticated, smart (KISS)
    [ August 29, 2004: Message edited by: Walter Tang ]
     
    Oh the stink of it! Smell my tiny ad!
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic