aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes search spec unclear Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "search spec unclear" Watch "search spec unclear" New topic
Author

search spec unclear

Laura Williamson
Ranch Hand

Joined: Apr 28, 2004
Posts: 44
SPEC FOR SEARCH:
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)

-- this is (perhaps intentionally) unclear.
-- do I have to match on posn. within the array or just on the search term?
e.g. if Fred is in the criteria array, at the posn. for owner, should i also return Fred's Frog Legs if that is the company name? or only searching for matches at posn[n]. Does that make sense? Is the match on any value in any field? or any value in a specific field?

--null in any of the criteria elements will return all records, no?

thanks
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Laura Williamson:
do I have to match on posn. within the array or just on the search term?
e.g. if Fred is in the criteria array, at the posn. for owner, should i also return Fred's Frog Legs if that is the company name? or only searching for matches at posn[n]. Does that make sense? Is the match on any value in any field? or any value in a specific field?

--null in any of the criteria elements will return all records, no?


1. No. I think it is the value that matches for that specific field identified by criteria[n]. From the example in your specs, it sounds like String.startsWith() method may be more appropriate than String.indexOf()...

2. Yes, null in any of the criteria elements is expected return all records.

Also be aware that the search functionality provided to the CSR at the front end level may be slightly different from the above.

Others: Please correct(enlighten) me if I am wrong
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Vishwa,

2. Yes, null in any of the criteria elements is expected return all records.
(...)
Others: Please correct(enlighten) me if I am wrong


You're right if while writing "any", you simply mispelled "all".

Best regards,

Phil.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Aah!...Just when I thought I understood the specs correctly!
Thanks for the correction, Phil. I was not clear in the above post.

null in any one of the criteria fields is not supposed to return all the records. (see Case 0 below).

null in the criteria[n] means "ignore the value in the field[n], do not use it to filter records", but null in all of the criteria[n] fields is supposed to return all records.(see Case 1 below)

Laura: I have provided some examples below. Please bear with me, I am not a SCJD yet.....

Say we have 3 fields in the database.


Case 0:

Criteria[0] = "Pete"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

- returns only 1 record (Peter's record)
- This does not return all records.

Case 1:

Criteria[0] = "ANY"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

- returns all records (as there is no filter at all here)

Case 2 :

Criteria[0] = "Robin"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

- returns 0 records (as there is no matching record with firstname starting with "Robin")


Case 3 :

Criteria[0] = "Fred"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

- returns 2 records (Suns's example in the instructions set).
[ May 19, 2004: Message edited by: Vishwa Kumba ]
Laura Williamson
Ranch Hand

Joined: Apr 28, 2004
Posts: 44
1) OK I assume where you put "ANY" you mean "NULL" ??

Case 0:

Criteria[0] = "Pete"
Criteria[1] = "ANY"
Criteria[2] = "ANY"

2) Match on fields makes sense to me. criteria [n] must match field [n] not just any field.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Laura Williamson:
1) OK I assume where you put "ANY" you mean "NULL" ??


Yes...I meant NULL.
Laura Williamson
Ranch Hand

Joined: Apr 28, 2004
Posts: 44
no probs, i got it now, thanks very much.

i read somewhere (on Sun site?) that a decent programmer would finish this assignment in 20 hours!! which makes me think that I must be really crap. o well, perseverance conquers all, i mean, most things...

one more question
any preference on storing record as a string [] of data
as opposed to
creating a Record object (i.e. having a record class, with the data as the fields?)
just wondering..........i've gone for string [] data, but maybe a Record would be more OO
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64
Laura,

20 hours? I must have done 2 hours a week then! Didn't feel like it at the time.

You can pass with either String[] data or a Record object. The choice, like most things in this test, is yours.

Perhaps you personally get more out of the exam if you use a Record object, as you said, it is more OO. String [] appears simpler and less challenging. As always document the choices available to you and the reason you prefer one method over the other.

Steven
[ May 20, 2004: Message edited by: Steven Hoodless ]

SCJP, SCJD, SCWCD.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Laura Williamson:
i read somewhere (on Sun site?) that a decent programmer would finish this assignment in 20 hours!! which makes me think that I must be really crap. o well, perseverance conquers all, i mean, most things...


http://www.coderanch.com/t/185567/java-developer-SCJD/certification/Sun-kidding

I think that's wrong. There are people here who have done the assignment in one month, but the number of hours they put in is more than 100. Max mentioned in the above thread that he would talk to Evelyn about the ridiculous time estimates at the SUN' site, but we haven't heard anything from him yet...

one more question any preference on storing record as a string [] of data as opposed to creating a Record object (i.e. having a record class, with the data as the fields?)just wondering..........i've gone for string [] data, but maybe a Record would be more OO


I am using String[] at the moment. No special reason, just wanted to keep it simple and also it saves me an additional class for the transfer object(Record object).Moreover the method signatures use String[] in the SUN's DB interface. Perhaps SUN's expectation? :roll:
Laura Williamson
Ranch Hand

Joined: Apr 28, 2004
Posts: 44
re Record v String []
-- ok, i got it.

re: time

I think I am pretty much an average programmer - in terms of the programmers who would be sitting this cert. I have an MSc Comp Sci and about 1 year commercial experience (but not in Java). Working with other programmers, I would normally be about maybe 3rd or 4th in a team of 10 - (based on speed, ease of solving problems, code actually working and passing testing, etc, etc) I'm not brilliant, but I can work it out (usually). I got 73% in the SJPC - again, about average. I think the assignment would take me between 100-200 hours. Maybe closer to 200 by the time I test and document it all. But I am not working on it solidly, as I work full-time. I just happen to be on 'training' this week...
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Laura,
Anywhere between 100-200 hrs sounds reasonable to me, depending on your knowledge of RMI, Swing, IO and locking. Even though I have many years experience, my knowledge of RMI, Swing, IO and threads is poor, so I am taking my own sweet time. I also have a full time job.

IMO, the difficulty of this assignment is understanding the not-so clear evergreen functional requirements.Secondly the locking concept is new to most people who have not written any multi-threaded programs.Once you get the functional requirements in your head and acquire the required basic skills in RMI, Swing and IO, it is easy to do the assignment. Daily/Weekly Commitment in doing the assignment is very essential. Atleast 10 hours
a week, if you wish to do it in 2-3 months with the minimum requirements to pass with a decent score.

BTW, I know a few brilliant people who did not get a good score in SCJD.This is one of the exams, where it is not required to be brilliant at all to pass the exam.

Hang around this forum and you will soon be a SCJD. An SCJD sooner than me, if you have that "bit of commitment to the assignment" that I mentioned earlier.

Cheers,
Vish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: search spec unclear
 
Similar Threads
A null value in criteria[n] matches any field value
interface spec.
Clarification on findByCriteria interface documentation (B&S )
URLyBird findByCriteria
Searching