Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming

Journal DrVomact's Journal: Humor in code--Unprofessional?

Do you ever inject humor into the comments of your code or—heaven forfend—into the code itself? I recently had a "code review" of a Perl automation program I had written for my department. The salient criticism that emerged was that there was "sarcasm" in my comments, and that this was unprofessional. In retrospect, it was not surprising that the criticisms concentrated on my comments, as no one else in this group does much programming (the PHB claims to have "been a coder" once upon a time...I think he wrote COBOL on punch cards); nevertheless I was dumbstruck. What kind of world is it where you aren't allowed the occasional funny comment in your code? Do we have to be serious all the time? I asked a programmer in the "R & D" group, and he responded with a complete unsolicited psychoanalysis: he advised that I should develop a "professional personality" that was different from my real one I use at home. I was shocked—nay, mystified: where do you learn how to do that?

But let's concentrate on the smaller, more manageable issue: is humor in comments truly verboten? Am I the only one who makes the occasional light remark, or even a self-deprecating reminder to "Change this, you idiot...what were you thinking"? I've resolved to take the humor issue to a jury of my peers: to wit, the esteemed denizens of Slashdot.

I received an annotated copy of my code from my PHB, pointing out all my lapses into "unprofessionalism." Here are a few of the lines from my program that were deemed "unprofessional", along with my comments, and meta comments). I cannot actually guarantee that there is any genuinely funny stuff here, only that the PHB thought it might be taken as such. (Sorry about the lack of indenting...couldn't figure out how to make Slashdot's subset of HTML do that.)

BEGIN {
if ($^O eq 'MSWin32') {
use Win32::Console;
Win32::Console::Free( );
}
}

Weirdly, nobody thought this was at all funny or objectionable.

# Set the directory if we got lucky
This was in a set of nested conditional tests that tried to find a file, no matter what crazy place the person running the program had stuck it. I fail to see this as sarcasm...I call it "cheerful optimism".

# Fix nasty problem where...
Comment in code that fixes crazy stuff in input files. Apparently, the word "nasty" is nasty.

$sysreturn = $proc->wait; # This gets exit code of process (it's already gone, so it's not really going to wait)
The parenthetical comment was marked as objectionable. You got me; I thought this was a potentially confusing line of code, and that the comment helped.

} else { # For all others, we just need to recover the original declarations that got eaten by the XSLTs
The word "eaten" was deemed unprofessional, sarcastic, or something.

my $status = shift @_; # 1 means the error causes certain death, undef or 0 means it's a warning (user gets to try again), 2 means it's a "notification"
Describes possible values passed to an error handler; "certain death" was deemed objectionable. Perhaps it was construed as a threat?

my %args = @_; # Stuff arguments into a hash, so we can look them up one at a time
"stuff" is an offensive word, apparently. All instances of "stuff" were marked as offensive. Good thing I didn't use "slurp", or "suck", huh?

if($name ne "subsection") { # We want the minor stuff included with first subsect file
To my great consternation, "stuff" is objectionable both as a verb and a noun! I think maybe PHB was using search-and-replace for his code analysis, though.

$button_text="Bummer!"; # It's NOT OK, man!
This one caused the most outrage. It's actually part of the code, unlike the other cases—it's the text of a button in a fatal error dialog. I completely hate when an application notifies me of a fatal error and asks me to click a button labeled "OK"—as if asking for my approval for having screwed up. Like my comment says...it's not OK. PHB wanted "OK", but I finally changed it to "Exit".

So, I ask you, my peers of Slashdot, to pass judgment on me: am I hopelessly unprofessional? Or have I discovered the real reason why so many programmers don't comment their code?

This discussion has been archived. No new comments can be posted.

Humor in code--Unprofessional?

Comments Filter:

I tell them to turn to the study of mathematics, for it is only there that they might escape the lusts of the flesh. -- Thomas Mann, "The Magic Mountain"

Working...