C
ChUIMonster
Guest
We probably need a thread devoted to the evils of FIRST. 999 times out of 10 it is being used without any thought by a programmer who either thinks it is required because they have never seen a FIND without it or because they once thought they heard that it was faster and faster is always better. For the record: FIND FIRST is only faster if it is also wrong. If FIND FIRST makes your code faster it is because you do not have a unique index to go with your WHERE clause. If you do not also have a loop and some FIND NEXT statements then you are ignoring the rest of the result set. That means that you are violating 3rd normal form. Either you are saying that the FIRST record has a magical attribute that the 2nd, 3rd etc do not or you have redundant data. If OTOH you do have NEXT statements then one has to wonder why you are not using FOR EACH? The overwhelming majority of FIND statements do not need and do not benefit from FIRST. Some FIND FIRST statements are subtle bugs that will probably never be tracked down and will intermittently bother users forever. A small number of FIND FIRST bugs are catastrophic. But still very hard to uncover. Especially when nearly every FIND has a specious FIRST glued onto to it. FIND FIRST everywhere is a bad coding habit. Don't copy bad code.
Continue reading...
Continue reading...