Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

recNo

 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Mark will do it from 1
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Kalle Tjarnlund
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic