A computer guru and his understudy were working. The understudy was having problems with his computer and in frustration tried a reboot to fix the problem. It was unsuccessful and his problems persisted.
The guru saw this, went up to the understudy, and told him... "You cannot restart your computer without knowing what the problem is and expect it to be fixed."
So the guru restarted the computer. And it was fixed.
edit: I mix past and present tense a lot. Bad habit.
An elderly programmer goes to sleep and puts two glasses on his nightstand. One glass with water, in case he wants to drink at night. The other glass empty, in case he does not want to drink at night.
Optimist: The glass is half full.
Pessimist: The glass is half empty.
Engineer: The glass is twice as big as it needs to be.
Programmer: That's a hardware problem!
Me: It's just half way. Unless it's being filled, in which case it's half full. If it's being drained however, it's half empty. But if it's just sitting there with a volume of water equal to half the volume of the glass, it's just half way.
Unfortunately, I don't understand Disch's or Cubbi's jokes :(
Disch's joke operates on several levels, and fudges some information for fun.
An experienced programmer will not miss stuff that a less-seasoned programmer would, and so even though they appear to do the same thing, the seasoned programmer will actually have done something different -- and not necessarily at the same time that you are watching them -- and so the 'guru's actions seem to be magic. The joke takes it up to the meta-mystical koan-type status.
Cubbi's joke was just showing an old programmer making sure to cover all possibilities, even though the handling may be absurd or unwarranted. It happens all the time in real life. Consider a real-life scenario: when displaying an organization's member directory. Some members do not want their phone numbers displayed in the directory that everyone in the organization gets. However, the 'administrator' may wish to force display for internal purposes.
It would be absurd to waste space in the directory printing something where no phone number needs to be displayed:
1 2 3 4 5 6 7 8
if ((is_admin && is_display_phone) || user[ n ]->is_display_phone)
{
cout << "Phone: " << user[ n ]->phone_number << "\n";
}
else
{
cout << "(Phone number not displayed)\n"; // So what? Don't display anything, then.
}
But, like I said, this kind of absurd code happens all the time in real-life.
Why did the ex-programmer airline pilot crash? He disregarded the low fuel warnings.
What did the ex-tester investigators say? Oh no, black box testing again.
@Duoas,
I think it's better to say something like N/A for missing values in some cases, because it makes it obvious that it's not supposed to be there.
While I agree with your sentiment, you should use N/A (or a blank field, or whatever is appropriate) for values that are supposed to be there but for some reason cannot -- not to show that a value is not supposed to be there.
In the end, though, it all depends on the requirements specification. In my particular example (membership lists), it is very common to only list information (1) asked for and (2) permissibly viewable.