Principle1: do NOT give more than necessary access permissions, for example:
1. define variables used exclusively in only one function as local;
2. define variables used exclusively in only one file as static;
3. declare read only argument as const *;
Principle2: tag code snippet according to its semantics;
1. declare all global variables with a tag like GLOBAL, so that you can list them;
2. use static_cast instead of forced type conversion;
Principle3: locality in SE:
1. gather all operations on some type of object in one or two files;
2007年4月11日星期三
订阅:
博文评论 (Atom)
没有评论:
发表评论