wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes recNo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "recNo" Watch "recNo" New topic
Author

recNo

Keith Jones
Ranch Hand

Joined: Oct 30, 2006
Posts: 105
In the spec we have various methods that take an int recNo as argument. Problem is that the database does not contain a record number field so does the recNo refer to the sequentially placed record in the database?

In other words does recNo = 5 refer to the fifth record? Further, could this not be interpretted as being the 6th record if we count from 0?


SCJP 1.4
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
You could do it either way I guess once you justify it. I suppose the most user friendly way would be to start record counting from one, although it makes things a slightly more complex (messy even?) in the data class
[ November 21, 2006: Message edited by: Mark Smyth ]

SCJP<br />SCJD
Keith Jones
Ranch Hand

Joined: Oct 30, 2006
Posts: 105
thanks Mark will do it from 1
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
The end user doesn't have to know anything about the record number.
For the Java developer it makes more sense starting them from 0 because everything else in Java does (trust me, I worked for 3 years in a company where we had to mix Java with a custom language that used 1 based arrays, it was a constant headache to remember which method calls used 1 based indices and which used 0 based indices).


42
Kalle Tjarnlund
Greenhorn

Joined: Aug 20, 2006
Posts: 10
Even though we are used to arrays starting at zero I think that the Data class should be seen as some kind of a database interface and if you check java.sql.ResultSet this interface states that the counting start at 1.

Regards,
Kalle


SCJP 1.5<br />SCJD URLyBird (in progress)
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
Yes, which goes counter to everything else in Java
See it better as a call to a mainframe where you're in control of both the mainframe and the client.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: recNo
 
Similar Threads
how to make create() allows multi-thread
NX: About data consistent
Problems with DBMain interface
NX: URLyBird Database Record Number Question
NX: Why do you all make LockManagers?