This is the 25th Step towards gaining the Programming Enlightenment series. If you didn’t learn the 24th Step, read it.
In a Windows program, an OK-button message box that came up whenever things went rather badly:
What the F**K are you looking at?
Programming is littered with stuffs in comment or some random unknown condition or when throwing unexpected Exception.
// They made me write it, against my will.
Exception up = new Exception("Something is really wrong.");
throw up; //ha ha
try {
} finally { // should never happen
}
These might be cute and hilarious as a developer, but leakage of this funny and stupid data might emerge anywhere anytime.
Examples include:
- During a status meeting, a client clicks on an button which is as yet unimplemented. They are told: “Don’t click that again, you moron.”
- A programmer maintaining a legacy system has been told to add an error dialog, and decides to use the output of existing behind-the-scenes logging to power it. Users are suddenly faced with messages such as “Holy database commit failure, Batman!” when something breaks.
- Someone mixes up the test and live administration interfaces, and does some “funny” data entry. Customers spot a $1m “Bill Gates-shaped personal massager” on sale in your online store.
Even your source code isn’t necessarily free of scrutiny. In 2004, when a tarball of the Windows 2000 source code made its way onto file sharing networks, some folks merrily grepped through it for profanity, insults, and other funny content. (The comment // TERRIBLE HORRIBLE NO GOOD VERY BAD HACK
has, I will admit, become appropriated by me from time to time since!)
TL;DR Before writing comments, logging, dialogs, or test data — always ask how it will look if it becomes public.