Compilers and warnings lights are there for help. Don't ignore them.
Enable all warnings
Enable preconditions and assertions in production.
array = ; console.log(array['1']) //undefined but keep going on hiddenGlobal = "I am a global" console.log(hiddenGlobal) // I'm a global
array = ; console.log(array['1']) //Index Error noGlobal = "I am not a global" console.log(noGlobal) // ReferenceError var noGlobal = "I am not a global" console.log(noGlobal) // I am not a global
Most languages have warning levels. We should turn most of them ON.
We should run linters to statically analyze our code for potential problems.
- Fail Fast
If we ignore warnings and code moves on sooner or later it will fail.
If the software fails later it will be very difficult for us to find root cause.
Defect will likely be near first warning and far away from the crash.
If we follow the Broken Windows Theory, we should not tolerate any warnings, so a new issue will not pass unnoticed on a sea of tolerated warnings.
Code Smell 19 — Optional Arguments
Maxi Contieri ⭐⭐⭐ ・ Nov 7 '20 ・ 2 min read
Photo by Noah Dominic Silvio on Unsplash
One man's crappy software is another man's full time job.
Software Engineering Great Quotes
Maxi Contieri ⭐⭐⭐ ・ Dec 28 '20 ・ 13 min read
This article is part of the CodeSmell Series.
Top comments (3)
Relevant section in one of my favourite programming books :D