Swearing in comments - what's the opinion now?

lilstevey on 2007-12-08T19:40:39

I've seen various articles on the web in the past expressing the opinion that placing swear words in comments should not be a reflection of the programmers profesionalism.

I haven't seen these sort of articles released recently, though have on occasion heard opinions stressed that its ok.



As a general case, I'm of the opinion that as a programmer you are responsible for quality of the entirity of your conribution, which you perform in exchange for your salary.



What the customer/employer decides to do with that code, unless expressed otherwise in the contract is totaly their business - not that of the employees.



Therefore, should the business decide to release the source code for the product, the comments become as public as the user interface.



This leads me to suspect that if I am right in suspecting that "cussing in comments" is passe, the commercialisation of open source could be a contributory factor - or perhaps its just a reflection of the maturity of the industry?



Or maybe I'm wrong, and there is still a belief that delivery of code is limtied to user experience.



Either way I'd be interested in the prevailing attitude towards what people percieve is a professional attide to software development. I'd also be interested if people have the same attitude to code released personally to that developed under contract?


"There's a Perl script for that..."

renodino on 2007-12-08T23:39:22

I'd think that scrubbing code of cusswerds should be de rigeur, because they can be a bit viral, and, in OSS, can reflect badly on the developer(s). So a Perl script to scrub such epithets from the source is probably a good idea.

A Cautionary Tale:
My opinion arises from a personal faux pas: during a fit of pique while bug-killing a particularly befuddling bit of code, I inserted some F-bombs into some diagnostics (the cause turned out to be a bug in Perl, btw, so the F-bombs may have been well deserved). After a scrubbing exersize, the s/w was shipped...and (you guessed it) a couple days later I got a note from a customer that one of the fbomb'ed diagnostics had erupted at his site. Thankfully, the customer had a good sense of humor, and I spent the next 24 hours doing penance by scrambling to cleanup my code (and my act).

cursing in code

rjbs on 2007-12-09T15:10:16

It's more of a problem in a language like Perl where the source is available and inspectable at runtime. Imagine if your webhost (or sysadmin) accidentally changes the error reporting behavior to allow exceptions to become visible to the user, and now they see the few lines of code around the exception... and it says something they find offensive or unprofessional. Heck, what if it says:

# The following code is totally insecure and we
# probably lose lots of customer credit card
# info because of it!
I try to always write comments with the assumption that someone will see them who should not. So:

# The code below should be rewritten to avoid
# format injections.  (see #1234)
In, say, C, this is less of a problem because comments have been stripped already and the people who see opened source are different than the people who see the interface.

As for the f-bomb (and associated ordinance), there's a more pragmatic reason to avoid it. Once, I saw someone accidentally commit profanity to a page and push it into production; it was an accident, the equivalent of leaving debugging statements in code. Obviously, it would've been just as useful to the designer to write "IT WORKS" as to write "IT FUCKING WORKS" (or whatever), but it didn't occur to him that it might get into production.

With something like t/bowdlerize.t, you can fail a test if any source file contains bad words. Testing for this made me realize that some proprietary JavaScript code that we'd bought contained a functioned called something like eliminate_stupid_fucking_khtml_bug -- good work, guys!

It's funny, even though I'm a coder and know the urge to write something like that, I immediately had a gut reaction that the authors were less professional than I had thought. Huh!

Oops

MarkyMoon on 2007-12-11T14:37:12

I once had some silly placeholder text accidentally make it into a print catalog. Often while working on this very large book if we didn't have a product description or photo we'd put something there just to take up some space on the layout... and to crack each other up.

One product, "Nipple Clamps", nothing weird - something to do with guns IIRC, didn't have a description so I put in something like "Ow. That's gonna leave a mark!".

Although that page and several other were actually changed later, the document became corrupted and we had to roll back to an earlier version. Guess what was in that earlier version.

None of these were caught during proof reading by several people and went to the printer. It was out a month or two before anyone noticed it and even though it wasn't actual profanity the boss was not amused!