Archive
Programming Best Practices
-
Declaring errors prevents security risks
Why you should care Exception handling is the process in JSP to handle runtime errors. Any number of exceptions can arise when JSP page…
-
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,…
-
Switch statements should have a default case specified
Switch statements should have a default case specified This code insight verifies the ratio between the number of switch statements with missing default cases…
-
Avoid exposing too many attributes
Avoid exposing too many public class fields This code insight counts the number of cases when an attribute is directly exposed outside a class…
-
Avoid repetitive access to nested members
Why you should care As explained by W3C: βAccessing the DOM in browsers is an expensive thing to do. The DOM is a very…
-
Avoid literal numbers (i.e. Magic numbers are not so magic)
Why you should care A magic number is a direct usage of a number in the code (e.g. βif($foo > 65)β) which refers to…
-
Exceptions shouldn’t be caught with system exception classes
Exceptions shouldn’t be caught with system exception classes This code insight detects and counts the usage of generic exception catches like catch(β¦), Exception, Throwable,…
-
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,…