Re: Murphy's law
Paul Cager wrote:
Lew wrote:
Tangentially related, I find it hard to sell 'assert' to programmers and their
managers sometimes. The most common objection is that it seems useless, which
has me scratching my head.
That might be reasoning along these lines:
Pointy-haired-boss: What does "assert" do?
Underling: If the program is correct, then "assert" does nothing. If
the program isn't correct then "assert" makes sure the program fails
rather than working accidentally.
"Underling"? "Underling"?!
Aside from that, clearly that is not the correct way to explain 'assert'. If
that's the best an engineer can do then they deserve the result.
"Assertions confirm the correctness of an algorithm at key points in a way
that the compiler and runtime can implement, but that doesn't get in the way
in production except when needed to troubleshoot tricky problems."
And who asks their manager for permission to use 'assert'? Do they mandate
'for(int ...' index forms over for-each? You don't need permission to do the
right thing. (But it darn well had better *be* the right thing, then.)
I wish assertions were enabled by default. At the very least it would
be good if they were on by default when running programs within
Eclipse.
So configure it to do so. It might not be the default default, but it is a
configurable default.
>BLING!< the fairy godmother granted your wish.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg