Archive
Programming Best Practices
-
Use of ‘return’ statement is not recommended
[vc_row][vc_column][vc_btn title=”SOFTWARE RESILIENCY” style=”flat” color=”black” i_icon_fontawesome=”fa fa-shield” add_icon=”true” link=”url:http%3A%2F%2Fdoc.casthighlight.com%2Fsoftware-resiliency%2F|||”][vc_btn title=”BEST PRACTICES” style=”outline” color=”black” i_icon_fontawesome=”fa fa-code” add_icon=”true” link=”url:http%3A%2F%2Fdoc.casthighlight.com%2Fcategory%2Fproduct%2Findicators-methodology%2Fcode-insights%2Fsoftware-resiliency%2Fbest-practices%2F|||”][vc_empty_space height=”12px”][vc_row_inner][vc_column_inner][vc_column_text] Why you should care [/vc_column_text][vc_column_text]Specifically in…
-
Do not compare to null
[vc_row][vc_column][vc_btn title=”SOFTWARE RESILIENCY” style=”flat” color=”black” i_icon_fontawesome=”fa fa-shield” add_icon=”true” link=”url:http%3A%2F%2Fdoc.casthighlight.com%2Fsoftware-resiliency%2F|||”][vc_btn title=”BEST PRACTICES” style=”outline” color=”black” i_icon_fontawesome=”fa fa-code” add_icon=”true” link=”url:http%3A%2F%2Fdoc.casthighlight.com%2Fcategory%2Fproduct%2Findicators-methodology%2Fcode-insights%2Fsoftware-resiliency%2Fbest-practices%2F|||”][vc_empty_space height=”12px”][vc_row_inner][vc_column_inner][vc_column_text] Why you should care [/vc_column_text][vc_column_text]Whenever null…
-
The code contains too many final artifacts in final classes
Unnecessary final modifiers inside final classes should be avoided. Final modifier prevents child classes from overriding a method by prefixing the definition with final.…
-
The code contains too many classes that declare __get() without declaring __set()
When __get() are declared, __set() shoud be declared as well.
-
Avoid abstract classes without abstract or concrete methods
Abstract classes can have public constructors, and this is required in some particular cases. But a public constructor means that the class can be…
-
Variables should be declared with ‘let’ or ‘const’
The distinction between the variable types created by var and by let is significant, and a switch to let will help alleviate many of…
-
Avoid caching selector for long time
Since object members may contain other members, itβs not uncommon to see patterns such as window.location.href in JavaScript code. These nested members cause the…
-
URIs (URL & path) should not be hardcoded for testability purpose
Hard coding a URI makes it difficult to test a program: path literals are not always portable across operating systems, a given absolute path…
-
Avoid undefined type on data or routines declaration
Groovy support dynamic types, that is declarations where the type is def or unspecified.
-
The code contains too many unnecessary COMPUTE
COMPUTE verb should be restricted to usage in combination with the ROUNDED clause or a function call or for complex computing expression.