Avoid unnecessary work

DON'T: In the example, below, the call to listSize() is unnessary. In most cases, you shouldn't need to write something to loop over a collection:


if(query.listSize() > 0) {
while (iter.next()) { .... }
} 

The call to listSize() will make an unnecessary call to "select count(*)". Let the iterator do the work. Avoid the extra call to the database.