Archive
Michael MULLER
-
Variables should not be shadowed
Overriding a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it…
-
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…
-
Multiline string literals should not be used
Continuing a string across a linebreak is supported in most script engines, but it is not a part of ECMAScript. Additionally, the whitespace at…
-
Logical OR should not be used in switch cases
The logical OR operator (||) will not work in a switch case as one might think, only the first argument will be considered at…
-
In switch ‘default’ clauses should be last
Switch can contain a default clause for various reasons: to handle unexpected values, to show that all the cases were properly considered. For code…
-
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…
-
try! should not be used
The use of Swift 2.0βs try! lets you execute code that might throw an exception without using the do and catch syntax normally required…
-
A field should not duplicate the name of its containing class
It can be confusing to have a class member with the same name (case differences aside) as its enclosing class, especialy when considering the…
-
Use == instead of ?: when dealing with nullable boolean
USE == INSTEAD OF ?: WHEN DEALING WITH NULLABLE BOOLEAN