Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

BS: interpretation of search criteria requirement

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From my spec:

"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've seen someone interpret this on this forum as meaning that you must be able to do all the following:

1. Search for records that match a particular name.
2. Search for records that match a particular location.
3. Search for records that match both a name and a location.
4. Search for records that either match a particular name, or a particular location, or both.

It's (4) I've got issues with. I think that 1-3 could be argued to be enough to meet the spec - it's only if you read every "or" as a "||" that (4) seems necessary.

Has anybody not provided 4 and passed the assignment?
 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
Can you explain (4) more detail?
I don't quite understand the difference between (4) and (1-3)
 
Ewan Livingstone
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, to pin down what I'm talking about, some pseudocode:

1. if (record.name == nameCriteria)
2. if (record.location == locationCriteria)
3. if (record.name == nameCriteria && record.location == locationCriteria)
4. if (record.name == nameCriteria || record.location == locationCriteria)

Does that help explain what I mean?

Incidentally, the reason I'm reluctant to implement (4) is just that the way I've designed my database layer means that implementing it would mean quite a lot of code changes. My database logic is a little too clever and abstracted for its own good
 
Ewan Livingstone
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another explanatory note!

Some people have implemented the search window so that as well as 'contractor name' and 'location' fields, there are radio buttons labelled 'and' and 'or'. With this design, if both name and location criteria are specified, the 'or' radio button corresponds to searching using approach (4).
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ewan,

I only implemented the �AND� condition, so any records must match criteria for all fields that are not null.

My reason for this was that I couldn't see a sensible (or simple) way of implementing the �OR� condition with the current find method signature (without adding a new search method), and from an application point of view it didn't make sense to me to support a search where you could allow the user to select a name of a hotel OR and location.

However one of my must requirements was :

Must allow the user to search data for all records, or for records where the name and/or location.


To me this requirement just means that the user can select :

  • Just the name
  • Just the location
  • Both name and location



  • I know alot of people have passed with this assumption, and just tried to keep everything as simple as possible, I felt that the find method signature doesn't enable the support of a complex search that you may find in a SQL database.

    Cheers,
    Jason
    [ June 23, 2008: Message edited by: Jason Moors ]
     
    Catch Ernie! Catch the egg! And catch this tiny ad too:
    free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
    reply
      Bookmark Topic Watch Topic
    • New Topic