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.
I am inclined to agree. I don't think this should be a hard and fast rule. Sometimes logic dictates that this is the correct construct. However the reasoning for the rule in JavaRanch is valid. The way I get round this is by placing the code for the do while in a method, therefore it is still possible to see from the start of the loop what the termination condition is.
Very occasionally I will stretch this to two or three method calls, but never any more than that. I know this makes it hard to define a "rule", maybe it should be a guideline.
I tend to agree with the Ranch on this one...just for consistency. This is how I work the code so that it works for me:
since I usually need the row count as well, there is no real performance cost of incrementing the counter. also to note, that incrementing a counter is hardly a performance cost especially when you start making hits to the database! Jamie
"JavaGibbon" Your name doesn't agree with the javaranch guidelines. Please take a moment and edit your profile after reviewing the guidelines at http://www.javaranch.com/name.jsp Please change your Publicly Displayed name to follow the guidelines. thanks for your cooperation. - satya