This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Just on this, have people passed with using both 0 and 1 as the starting number for recNo ?? As i'm wondering myself.
I would have thought this would be an important point, and not open to your own decision, as surely the automated testing program of your Data class would do a read(recNo) and match up against your submitted database. If your interpretation is wrong they would not match ...
I think it's not an issue and completely up to you. I used 0 and didn't document that decision, because I never considered the use of 1 as a starting point, because everything in the Java world is 0-based: arrays, lists, stringbuilders,... And I agree with Alex: for the real user it makes no difference if it's 0 or 1 (as long as he/she sees the correct record) and another java developer could also be the user (having to make changes to your program), so it won't be that intuitive for him/her.
But if you give some good reasons to start with 1 in your choices.txt, I don't think it is a problem and you certainly won't fail automatically because of that.
It sounds to me like either will pass sun's automated software test. If it does a read(0), it either works correctly and matches up the record, or throws a RecordNotFoundException, if so, checks read(1) and matches the record so either option is acceptable.
Well the choice is up to you ... my answer is just like everyone else
But if you look from the JTable (which start from row 0) then technicaly you don't need to do all the conversion from data to model and vice versa. From the collection (eg list, map, set) again the first item is 0. Just a point to ponder.
RecNo reflects primary key number..and in my view it's not god ideia start with 0. Did anyone see any database start primary key with 0 ? I not !!!. Anyway, you can identify a registry with 0.....so you can use it....is up to you. I chose start with 1 that is meaningly correct.
See you around...