




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Don’t use implicitly declared variables (VB allows this – C# does not) Do use naming conventions Remove unused variables Use all variables that you declare
Variables should “accurately” and “fully” describe the entity Don’t use obscure abbreviations 1 character variable names are OK for scratch values i,j,k are common Put modifier at the end of names (not the beginning) Total, Sub, Average, Max
Use opposites precisely Avoid the use of the word flag Use boolean names done / error / found / success The name should imply true or false
Declare and initialize variables together A variable’s declaration and first use should be together (or close) Use constants where possible Don’t use literal values
Use variables for a single purpose Don’t reuse counters and accumulators If you do, tell the reader Minimize scope visibility Use local variables over global variables where possible Minimize persistence Avoid names with hidden meanings