3 ms·
To echo one of the comments on the linked post --- it is because of bugs like this that I am a firm advocate of languages with strong static checks. A few clai
by emu 15y ago
To echo one of the comments on the linked post --- it is because of bugs like this that I am a firm advocate of languages with strong static checks.
A few claims:
* no matter how good a programmer you are, you will make stupid mistakes (such as typos, as in the case of this article) every now and then.
* it is statistically inevitable that you will make many such errors in a large code base.
* bugs are easier and cheaper to fix the earlier you catch them; the best time to catch a bug is before the code is paged out of a programmer's brain.
* it doesn't take too many experiences of discovering a typo bug in your "production" code base before you realize there must be a better way.
My personal approach is the following:
* restrict the use of untyped scripting languages to pieces of code that can fit in one screen or so; that is, just small enough that you can keep all of the moving pieces in your head at once.
* as much as possible, use languages and tools that provide strong static checks for larger projects. This includes language type systems (e.g., Scala, OCaml, Haskell, etc.) and tools that help you check your code (Prefix/Prefast, Coverity, Findbugs, etc.)
* testing is good, but static checks are far better.
Unfortunately these opinions don't match common practice in the web programming world.
- grncdr 15y agos/types/predeclaration/ and I 100% agree. I'm not a huge fan of Perl, but strict mode is something I really miss when working in Python/PHP/Ruby/Lua.