FPX:
If there are two or more ways to do something, and one of those ways can result in a catastrophe, someone will do it. Therefore,
Murphy concluded, things should be engineered in a way so that there are
not two or more ways to do something.
This page is intended to collect advice on good engineering practice for building software with Murphy's advice in mind, and, as negative examples and for entertainment, anecdotes of catastrophes caused by accidental misuse of software.
- Tcl and octal numbers: Interpreting a string as a number may have unexpected results. How many Tcl-based software can you break by entering "09" in a numeric field?
- switch $var {...} will make a runtime syntax error if $var starts with a dash - so always write: switch -- $var {...}. MJ - Note that in Tcl8.5 it is recognized that $var cannot be a switch (because it would be a syntax error) So the -- is not needed.
- Nancy deserves a mention, as a cautionary tale about mixing strings and numbers (hint: use eq):
if {"nan" != "nan"} {puts "Nancy was here"}