Alex Thottunkel
- Total activity 2325
- Last activity
- Member since
- Following 0 users
- Followed by 0 users
- Votes 1
- Subscriptions 1186
Articles
Recent activity by Alex Thottunkel Sort by recent activity-
Avoid 'switch' with too many 'case' statements
Why you should care When switch statements have large sets of case clauses, it is usually an attempt to map two sets of data. A real map structure would be more readable and maintainable, and shou...
-
Variables should not be shadowed
Why you should care Overriding a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers ...
-
Variables should be declared with 'let' or 'const'
Why you should care The distinction between the variable types created by var and by let is significant, and a switch to let will help alleviate many of the variable scope issues which have caused...
-
Multiline string literals should not be used
Why you should care Continuing a string across a linebreak is supported in most script engines, but it is not a part of ECMAScript. Additionally, the whitespace at the beginning of each line can't...
-
Logical OR should not be used in switch cases
Why you should care The logical OR operator (||) will not work in a switch case as one might think, only the first argument will be considered at execution time. How we detect CAST Highlight coun...
-
In switch 'default' clauses should be last
Why you should care Switch can contain a default clause for various reasons: to handle unexpected values, to show that all the cases were properly considered. For code readability purpose, to hel...
-
Avoid caching selector for long time
Why you should care 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 JavaScript eng...
-
URIs (URL & path) should not be hardcoded for testability purpose
Why you should care Hard coding a URI makes it difficult to test a program: path literals are not always portable across operating systems, a given absolute path may not exist on a specific test e...
-
try! should not be used
Why you should care 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 for such code. By using it, you're guara...
-
A field should not duplicate the name of its containing class
Why you should care It can be confusing to have a class member with the same name (case differences aside) as its enclosing class, especialy when considering the common practice of naming a class ...