Archive
Programming Best Practices
-
Handling Exceptions should be explicit
How we detect This code insight counts one violation each time : bad def divide(a, b): try: result = a / b except: result…
-
Switch cases without ending breaks are hard to understand
Why you should care Although Switch cases do not require ending breaks after the default statement, It is recommended to end every branch with…
-
Too many classes with missing constructors can be risky
Too many classes with missing constructors can be risky This code insight counts a violation each time C++ has too many classes with missing…
-
Missing default in switch statements can cause Production Risk
Missing default in switch statements can cause Production Risk This code insight ensures that the keyword “default” is executed when none of the conditions…
-
Avoid using SELECT … ENDSELECT statement
Avoid using SELECT … ENDSELECT statement This code insight shows that The SELECT … ENDSELECT works as a loop fetching single record for every…
-
Avoid using dynamic queries
Avoid using dynamic queries This code insight shows that dynamic queries are difficult to test and can decrease the code understanding. Moreover, include dynamic…
-
Too many unconditional branches may end to Spaghetti Code
Too many unconditional branches may end to Spaghetti Code This code insight counts the number of unconditional branches (e.g. GOTO, continue, break except if…
-
Using {curly braces} is less error-prone
Using {curly braces} is less error-prone This code insight counts the number of missing curly braces in constructs such as functions, loops (while, do,…
-
Avoid using risky patterns too frequently
Why you should care Some specific code syntaxes, even if they compile and don’t make a software crash directly, are not recommended mainly for…
-
Native Dynamic SQL is easier to use than DBMS SQL.
Native Dynamic SQL is easier to use than DBMS SQL. This code insight shows that PL/SQL provides two ways to write dynamic SQL: However,…