This page is not intended to include a comprehensive list of everything that should be checked during a code review for CPS. Instead it attempt to list to less well known or very often (forgotten) rules that we should apply in CPS to keep the high quality of our production and test code.
Simple is Good, Complex is Bad
There is one simple rules that applies to all code and can often be used to decide between several coding solutions:
Common Mishaps
# | Description | Bad | Good |
---|---|---|---|
1 | Overuse of constant for String Literals (that don't add value) Also duplication is not a good reason, it often 'smells like' a method that should be extracted out instead |
|
|
2 | Avoid using ! when else block is implemented |
| if (x==null) { report error } else { do something } |
3 | No need for else after return statement |
| if (x==true) { return something; |