Posted
by
Zonk
on Thursday June 16, 2005 @10:45AM
from the looking-at-guts dept.

An anonymous reader writes "Ten million lines of code and not a single profanity? Is that really possible? Apparently, yes, says OpenSolaris community manager Jim Grisanzio. He said even before Sun filtered the code, it was relatively free of profanity. 'They went through the code for a great many things,' he said, 'and I'm sure they cleaned a word or two. Or three.' But a careful look through the code will reveal some programmers' frustration." From the article: "The most embarassing comment came from a developer of the GRUB project who went only by the name of 'Gord'. 'This function is truly horrid,' he wrote. 'We try opening the device, then severely abuse the GEOMETRY->flags field to pass a file descriptor to biosdisk. Thank God nobody's looking at this comment, or my reputation would be ruined.'"

Sounds like Sun did a bang-up job with their software, reining in the developers under pretty solid coding guidlines. It's the Open Source people who have gone off and sullied the code with their silliness.

Humor in comments is sometimes good. Just not on Slashdot where it only risks your karma.

Agreed. In my work placements at University I was putting 'funny' comments and debug output in code. I got pulled aside by the manager and told it was definately not on. I thought he was being a bit boring at the time but now looking back I can see it was a geat piece of advice.

I like the guy's humour. Either that or he is not smart for putting a reputation-ruining 'bomb' in the source code:-) But anyway... good programmers are supposed to be very critical of their code so even functionally correct code can be commented as though it were horrible.

ZDnet seems to want us to think "clock speeds" are at 3 Ghz regarding the following quote:

'Another tried his hand at predicting the future of system speeds. "As of this writing (1996) a clock rate of more than about 10 kHz seems utterly ridiculous, although this observation will no doubt seem quaintly amusing one day," he wrote.'

But in 1996 you had roughly 100Mhz 486s and Pentiums, so clearly it's not that clock, it's some other clock.

something really interesting in the code, now that Solaris is open?
People has been saying "Sun will never open Solaris" for month, now that it is open all that they do is to grep "fuck" or "shit", or look for frustrated comments?

When you are doing a bid do having a conference after winnign one do you sit down and say,

Yeah, we can code that fucking system no problem. I mean shit man it may be hard as shit but we can meet that deadline. What we need to know is why the fuck did you want that in there. Can't we just get rid of this shit and move this over here. Fuck man, it makes more sense.

I don't think so. Being a professional means acting like a professional and only adding comments to code that help explain the program.

Having outsourced HUGE amounts of programming in my life, I can say that finding a comment like "Fuck this a hack." would not be a plus for the vendor in question.

At least Gord's comment gave some indication of what the code was doing.

My pet peeve is a block of utterly inscrutable code, with nothing but the following comment:

// This is an ugly hack.

Seriously, commenting effectively is *so* simple. If a brief comment neatly sums many lines of code, it's useful. If it explains a subtle interraction with some other bit of code somewhere else, it's useful.

If it points out the blatantly obvious -- yes, ugly hacks are very easy to spot -- don't bother! I don't care that you realize your code is ugly, I just want to start understanding it without reading every line in the project!

This article has all the sophistication of a 5-year old looking up 'anus' in the OED. Someone already pointed out the confusion between the processor clock and the system clock -- a confusion that would have been avoided if the author had read the code or even the rest of the comments.

More ludicrous is the author's supposed identification of a Mark Felt lurking in the shadows of the DTrace code:

The much-vaunted dynamic tracing (dtrace) feature of Sun's system may not be as safe to use as most people think.

That's based on what? The two ASSERTs that follow the cited comment? This one doesn't go all the way to the top...

It sounds boring, and it easy to make fun of, but I think (in general) the comments reflect the ability and maturity of the programmer.

If I'm trying to fix a mess of code and the comment says
// We're fucked, this shouldn't happen
My first impression is the coder was an idiot practicing stream of conciousness coding (which is more like typing, really). He's vented and that made him feel better, but it really hasn't helped me at all.

If the comment over that same code says
// Bad news. The lock was set, but somehow we're in the think-it's-unlocked section
My first impression will be much more favorable. The coder has mastered his anger and left me a useful clue to the problem.

I realize that dozens of "comment f*ckers" will descend and use their rich language skills to correct my misconception. But I've been designing and implementing software for almost three decades now. There are exceptions, but my data points show that profanity never improves the code and leaves an unprofessional appearance. Period.

I mean, would you hire a carpenter who wrote "F*cking nailgun!" on every 2x4 that gave him a problem? That would be some house.

I've got my list of red flag words in place, but I've been having some pretty serious problems writing an effective filter... Has it been solved already? Googling for a comprehensive profanity dictionary at work is... tricky.

Yes, the solution is:

Do peer reviews.

There are other benefits, which you can read about in books by the likes of Kent Beck and Martin Fowler. But I'll bet that if you made it a policy to do reviews, and a policy that profanity would not be tolerated, it would clear up sooner than later.

Secodn that - shoot for the ideal, knowing full well that the customer will very likely move the goal posts before you're finished, either shortening the deadline and/or insisting on bolt-on extras with no additional time allowed.