> Programmers *cannot* intuit from the code that modulus is a better > hash function when the denominator is prime. Sorry, they just can't. > Either they know it or they don't. The author can either leave those > that don't happen to know this fact clueless (in which case they are > liable to needlessly degrade the design during maintenance), or > can simply include a comment. Even if you document this fact in > a design document, the odds are fair that the guy getting ready to > change that table size didn't read it or doesn't remember it. This is > a case where you want that information RIGHT THERE with the > code to prevent damage during maintenance. That's what a comment > is for.
Any programmer worth their salt would instantly see that 31 was an odd choice of size and be alerted that it was special in some way, without having to read the comment. > This is representative of a whole class of comments of the form: > "I know you don't see any need for this code, so I will tell you > why it exists." Without this sort of comment, extreme amounts of > time and money are wasted as a maintenance programmer > "refactors" out some "unnecessary" code, ships a product, and > much later discovers that in some very obscure situation, that > code really, really was needed. Can you intuit that need from > the code? Absolutely not! Is there some superior way to convey > that information instead of a comment? I don't think so -- you want > that information Right There so that the programmer who would > likely do the damage can't miss it. Much better to use conditional compilation of some kind round code like this. (That is a kind of commenting though) L. - Automatic footer for [EMAIL PROTECTED] ---------------------------------- To unsubscribe from this list, mail [EMAIL PROTECTED] unsubscribe discuss To join the announcements list, mail [EMAIL PROTECTED] subscribe announce To receive a help file, mail [EMAIL PROTECTED] help This list is archived at http://www.mail-archive.com/discuss%40ppig.org/ If you have any problems or questions, please mail [EMAIL PROTECTED]
