Zen of Defensive Programming: A word about constants

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 create pseudo-constant values.

For argument’s sake, I will refer to constants as const in a C++ context in this post. In java, look for t...

 •  0 comments  •  flag
Share on Twitter
Published on April 04, 2023 11:12
No comments have been added yet.