I don't know if any of you have been following the release of Microsoft's code into the wild (call the Orkin man), but on a /. discussion there were a few people amazed at the profanity they found grepping through the MS code. So somebody else pointed out that:

% grep -Hirn "bleep" /usr/src/linux/*
or the milder:
% grep -Hirn "bleep" /usr/src/linux/* | wc -l

yields some interesting results if you substitute bleep with your favorite vulgarity. I was thinking about it, and although I think it's very unprofessional for any employees of any business to swear where it might offend, I'm not so sure I find their conduct apprehensible. (Come on, we've all had bad days where we just wanted to bang out @#*!@$ on our keyboard until our hearts content somewhere in comment tags). Since comments are discarded during compilation, and M$ doesn't let anybody see the code (willingly), it's not as if the M$ employee(s) added vulgarities to the menu of Office.

So this begs the question, how clean is your code (in regards to profanity), and what are your thoughts about profane code (esp in a professional enviornment)?


Want to support the EFF and FSF by buying cool stuff? Click here.

Replies are listed 'Best First'.
Re: How clean is your code
by Abigail-II (Bishop) on Feb 13, 2004 at 22:21 UTC
    Actually, profanity in comments *can* be interesting. It's not interesting if it's from a programmer who utters the word fuck in every fifth word he speaks. But a rant in which the programmer reliefs his frustration (because of himself, of some not well thought through API, or about some ambigious worded spec/RFC/standard) can be very nice to read. If it contains profanity, so be it.

    But then, I like to read the scary devil monastry as well.

    Abigail

Re: How clean is your code
by BrowserUk (Patriarch) on Feb 13, 2004 at 23:08 UTC

    I don't understand why 5 or 6 particular 4-character combinations from the nearly 1/2 a million possible create such a stir.

    It's not the just the sight or sound of them of them else chit, cult, buck, pass and a host of others would also be deemed offensive.

    Mostly, I don't think people are offended, rather they take offense.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!
      I don't understand why 5 or 6 particular 4-character combinations from the nearly 1/2 a million possible create such a stir.
      That's like saying: I don't know why the sequence rm -rf * should cause such a stir. As a programmer, you are quite familiar with semantics, so your purported lack of understanding smacks of careless wit rather than a serious enquiry.

        Au contraire. If it all came down to semantics, then close mis-spellings like fcuk, sh1t and others would still be offensive even though the syntax is wrong. The first of the preceeding has appeared in 4 ft high letters on the High Streets of every major town and city across the UK for something like 20 years. No-one is offended.

        Equally, if semantics is the key, then the euphemisms used in various long standing 'kiddies favourite', Saturday morning staple TV shows, like F o o l! (and punk!, and sucka!) or smeg or smeghead or Frikkin' or Freakin' would all be deemed equally offensive.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        Timing (and a little luck) are everything!
Re: How clean is your code
by dreadpiratepeter (Priest) on Feb 14, 2004 at 02:48 UTC
    I've had this very discussion with co-workers at several jobs. They all thought I was being pedantic when I said that you never put anything that might be offensive to a customer anywhere in the code. and that you should assume that the customer is the world's biggest prude when deciding what can offend.
    They always responded "But the customer will never see the source code"
    To which I was answer, "You hope they won't, but you can never be sure."

    Boy do I feel vindicated today!

    I've been on projects where I have removed comments in which programmers said rude things about the customer- by name (and put their initials at the top of the comment, apparently so that management would know who to fire).

    When it comes to clients, you can never be too careful.


    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
Re: How clean is your code
by pinetree (Scribe) on Feb 13, 2004 at 22:11 UTC

    How clean is my code? Pretty good as far as prfanity. How's my code as far as odd variable/subroutine naming? Better to tilt at windmills and call them silly names than swear outloud.

    I guess the answer to the first question hints at my answer to the second. If you're going to call yourself a professional, you need to act as a professional as well. I can think of a couple parallels in life:

    I have a 22-month old son. Is it OK for me to swear when I'm at home with my family but make sure I'm on my best behavior in public? Am I setting a good example for my son?

    I'm involved in a search and rescue team. Is it OK for me to ridicule someone who is lost and I'm out in the woods looking for?

    Oren

      I'm involved in a search and rescue team. Is it OK for me to ridicule someone who is lost and I'm out in the woods looking for?

      A good friend of mine is a paramedic, and if I ever go to the bar with her and her paramedic buddies they sit around the table / bar making fun of patients. So far as I know, they never actually make fun of anyone to their face, but it's a way of relieving stress from their job. This is where I think it gets to a gray area. No, they shouldn't make fun of people on the job. But if that's a defense mechanism, and they are only human, isn't it forgiveable? (Not that it isn't interesting listening to the stories about old men who shoot themselves in the foot cleaning a loaded gun)


      Want to support the EFF and FSF by buying cool stuff? Click here.

        Doctors used to take the Hippocratic Oath. They don't any more, and neither do your friends. That's one reason neither are trusted.

        After Compline,
        Zaxo

Re: How clean is your code
by allolex (Curate) on Feb 14, 2004 at 13:11 UTC

    The grep command you used works a little better if you add word boundaries: grep -Hirn '\bbleep\b' /usr/src/linux/* (Think of "Matsushita".) Now everyone knows I've actually done this. ;) Amusing reading, indeed!

    --
    Allolex

Re: How clean is your code
by Limbic~Region (Chancellor) on Feb 13, 2004 at 22:28 UTC
      Thanks, for the link about cleaning your code of profanity using Perl. I figured I could start a pretty interesting discussion about whether or not profanity in a professional enviornment is OK, and how many people routinely pepper their code with profanity.

      Want to support the EFF and FSF by buying cool stuff? Click here.
Re: How clean is your code
by coreolyn (Parson) on Feb 14, 2004 at 12:54 UTC

    Yeah I 'peppered' some code at work with stuff. It was on a large application that I wrote mostly in my own time in an increadibly short time frame. They were all in the form of print statements that I used for debugging. Things (tamed down) like print "WTF does \$var = $var\n". It helped me to stay amused while I pulled off what many had said 'Can't be done'. I did forget about them until our configuration management team checked in the code... at which point I quickly deleted the offensive lines

    Moral of the story: If you're good and pull off the impossible and a little racey language helps to get the job done WTF?

Re: How clean is your code
by Caron (Friar) on Feb 14, 2004 at 20:56 UTC

    How clean is my code?

    Paraphrasing the copyright on most CPAN modules, I would say as clean as Perl itself.

    Running PodMaster's prophanity check against Perl 5.8.3 source code, I didn't find anything that could offend my nieces' ears.

    Shall we start a campaign? Use Perl, the clean language :)

Re: How clean is your code
by exussum0 (Vicar) on Feb 15, 2004 at 12:34 UTC
    It depends on the environment. Last year or so, I worked for a .com company. My comments were kinda lose, but never vulgar or disparaging. I work for a financial company now, and my comments are very blunt and to the point. My OSS stuff, it's whatss on my mind.

    The one reason to keep your comments mostly professional? It's politics. If people actually like your comments, for being witty, or useful, then people like you better. You get more help from people, etc etc..

    One of my professors said it best. You can be completely technical or be a complete politician. Being completely technical can take you so far with a company before you get yourself fired. Being a politician, you can work anywhere in the company, and survive -- as you know how to make everyone happy and want you around.


    Play that funky music white boy..

      "Being a politician, you can work anywhere in the company, and survive ..." as long as you succeed to hide the fact that you do not produce anything. But if you choose a big enough company you should be able to hide that indefinitely.

      Jenda
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
         -- Rick Osborne

      Edit by castaway: Closed small tag in signature

Re: How clean is your code
by theorbtwo (Prior) on Feb 16, 2004 at 23:48 UTC

    Overuse of certian words, be they "thing", or "fuck", dulls your vocubaulary. Cutting certian words out of your vocabulary does the same, in a far more obvious way. That's beside the point, in a way, just an intersting asside.

    Wether or not you should consider profanity in your code important is up, mostly, to how professional you want your code to look. If it's open source hobby programming, it's not that important -- you aren't trying to be professional. If it's closed source, it's not that important -- only your coworkers will know, and I'd like to think that if a little prophane language will get you booted or looked down upon, then it's not a very stable social situation, and it's probably best to polish up the old CV anyway. Now open code in an compony situation is the only place left, and how often does that really happen.

    (It's worth noting, BTW, that I'm unemployed, though I've never been fired for swearing on the job -- though I did once get warned about it, at Staples.)


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      It is quite difficult to try to sell something opensource to management when there is profanity (or other "unprofessional" wording) in the documentation. Personnally, I do not have a problem with them (my wetware filters work pretty well), but the old "be conservative in what you generate, and liberal in what you accept" axiom is appropriate here. If I am recommending something, I feel it should also reflect on how I would code as well.

      A few examples of what I have taken into consideration when recommending OS / Free software:

      • Emacs comes with a few man pages that I would be "professionally embarrased" to have my management find.
      • NSIS has some minor stuff in its documentation that I would not want to release to our customers ("installer that doesn't suck"), and IIRC, some stuff that raised my filters.

      I guess I would agree with one of the previous posts that states "not to put anything in your code you wouldn't want the customer to find."

      My $0.02.

      --MidLifeXis

        The question here is if the writers of emacs and NSIS care.

        For NSIS, that's easy to answer. Considering it came from NullSoft, whose flagship product's slogan is "it really kicks the llama's ass", I think the answer is a resounding no. They wanted, primarally, to give the community making plugins for winamp to have an "installer that doesn't suck". They could care less if your management likes the style in which the documentation is written. In fact, style does sell, and the style with a decent bit of profanity is what sells to their target audiance.

        Of course, as with many things emacs, their intent is largely "fuck if I know". However, promoting informality and usabilty is important to them, I think, and not frowning overly much at prophanity is part of that culture.


        Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: How clean is your code
by etcshadow (Priest) on Feb 18, 2004 at 21:05 UTC
    Interesting exercise... Frankly I'm impressed (I was guessing closer to a hundred):
    [me@host]$ grep -rish '\b\(shit\|\(mother\)*fuck\|damn\|crap|hell\b\|a +sshole\)' * # the damn sign wrong!!! So we have to flip them all. # currently, it's just too damn messy to try to make ProcessKi +ckaction print "\n\n\n\nHOLY SHIT, THERE ARE COLS THAT NEED TO BE SCRAMBLED T +HAT WEREN'T: \n\n $missed_cols\n\nBETTER CHECK THAT OUT LEST YOU WIND + UP IN JAIL\n"; [me@host]$ find -type f | wc -l 5033 [me@host]$ find -type f -exec cat {} \; | wc -l 1102070 [me@host]$
    Of course, a more humorous (and more illustrative of our team culture) grep is this:
    [me@host]$ grep -rish '\bhack' * | wc -l 241 [me@host]$
    ------------ :Wq Not an editor command: Wq