4 ms·
Even some code writing practices exist with the goal of "making the mistake impossible to be made". E.g. in C or C++ introducing the practice of writing the con
by acqq 6y ago
Even some code writing practices exist with the goal of "making the mistake impossible to be made". E.g. in C or C++ introducing the practice of writing the constant first in the conditionals:
if ( 0 == x )
makes the mistake of accidentally writing assignment there impossible (0 = x would generate an error). However, my belief is that we should both demand and expect from the tools to have the "reasonable defaults" i.e. even if the
if ( x = 0 )
is a valid code, the "reasonable default" of the compiler has to be at least a warning. But who says that the environment where the compiler is used has "reasonable defaults" itself? I've worked in some environment where it was really expected from every participant to "ignore the warnings" produced during the build process. Which just shows how hard it is in some environment to even start a culture of "making the errors less possible": "don't waste the time, we have other methods to detect the problems, just do how it is done here" etc.
Viewed from the higher level, it is always about human weaknesses, still, it's always harder to address such weaknesses present on the higher levels.