It is time to tackle one of the key subjects of defensive coding practices—the use of constants. Why so many programmers ignore this important language feature, I am not sure, particularly in Java, C, and C++. Python makes it a little harder to use because the language lacks intrinsic support for constants, but with a simple-work around, Python can also… Continue reading "Zen of Defensive Programming: A word about constants"
In my previous installments, I showed you how a little bit of cosmetic change in the layout of your source code can dramatically improve readability and how tiny changes in your habits can truly affect overall code safety. In that vein, let’s continue and take this a little bit further by visiting Ternary Operators. One, or the other Ternary operators… Continue reading "Zen of Defensive Programming: Ternary Operators"
Your job is not to try and outsmart the compiler. Your job is to ensure you get the implementation right. The compiler’s job is to build the best possible executable code for it. Here are ways to make your code better and more compatible.