Inside the OpenSolaris Source Code
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.'"
What's this fascination with dirty words in the code? I can't say that I've even considered writing such a thing in commercial code that I write. Unlike OSS code, other coworkers *will* be reading my comments and may not think they're that funny. (Although I love messing with test data. Batman, Picard, Superman, Professor X, Dylan Hunt, etc. are all game. Unfortunately, they all share a phone number with Jenny. Must be one of those antiquated shared lines. ;-))
Perhaps the most telling part of the article is that it's the Open Source code that has the foul language. Which isn't too surprising. If there are no repercussions for such behavior, why wouldn't developers engage in it? But in a straight-laced commerical environment? Unlikely. (Or at least uncommon.)
Javascript + Nintendo DSi = DSiCade
I write very similar things into my code. My coworker and mentor yells at me about it. I think they're great little bits of levity when your code gets you down.
Don't buy WoW Gold! Make it yourself!
Code is so much better when your reputation is on the line amongst your peers.
I always think that peer esteem is one of the biggest contributing factors to the quality of open source code.
Yes, the locking code in mutex.c is fascinating. They dynamically switch between spin-locks and adaptive backoff locks based on who is running and who is locking what. This is the stuff that makes Solaris scale to dozens of processors out-of-the-box.
Silliness???
...
As far as the kernel is concerned the number of profanities is a clear reflection of the quality of the underlying hardware. One of the things I do before buying new hardware is look at the comments in the linux kernel code. If they are like the ones you meet in the sun** architecture bit (it is the most profane part of the linux kernel) it may be a good idea to stay away.
For example just read the sunhme.c under drives/net. It is an absolute ROFL. Or arch/sparc/mm/ptrace.c
Baker's Law: Misery no longer loves company. Nowadays it insists on it
http://www.sigsegv.cx/
JWZ has a selection of some of the choice obscenities from Netscape: http://www.jwz.org/doc/censorzilla.html
Unfortunately, I can't. As a Open Source/Free Software author, the CDDL specifically prohibits me from learning anything from looking at the OpenSolaris code.
Because its covered by a "file-based" license, I can either take files in full, or not at all. I am not covered by the CDDL (and would be in violation of it) by taking snippets of code from any of the files, including viewing them and "paraphrasing" what I learn back into my own code.
Also, there ARE patented concepts in the OpenSolaris code, which you are welcome to use, as long as you use entire files (i.e. covered by the "file-based" license). I don't want to put any of my clients or projects at risk, so I can't look at the code.
So nope, I haven't even looked at the code, because frankly, I can't, without contaminating my own code and ideas.
And sometimes they are also the place you express the frustration you feel at the particularly dismal piece of architecture someone handed you, that was a poor architecture in the first place and has subsequently been further bastardized into something whose design logic no longer exists in any coherent form, and in which any time you touch the code, there is a decent chance of side effects.
I try not to be profane. If I really want to imply some sort of upset or exclamation, I'll got the old cartoon route of using @#$%^%&!!!!! as a replacement.
But I find people sometimes shy away from identifying poorly architected code, odd inputs our outputs, or places where the approach taken was a kludge that needed to be thrown in but wasn't very good for fear of having an unflattering comment in place. Frankly, I'd rather know about these situations. I'm a big boy... if someone writes that a particular routine is a steaming pile of crap, that won't offend me, as long as the description is technically accurate (the routine actually is) and there is sufficient other data with the comment to tell me WHY this is so.
A co-worker of mine put in this one recently....
<ecode>
' Quick kludge because of time. Should not rely on global structure
</ecode>
Sure, it reveals that we've put a hack in when we should have done it a different way. But at least whoever the next poor bugger that comes along can be 'in the know' and not thinking that we mystically thought this was the 'right' way to solve the problem.
I also like to put in comment tags I can quickly locate in a search (<i>ANAKIN, WORF, BLAKE, GARTH OF IZAR, etc</i>). Sometimes they get left in. Do they cause any grief? Not really. A friend of mine uses the tag <i>WALLY</i> for all of his temporary patches and now this has infested the code bases at at least 4 companies (and other developers use it). You know if you see a <i>WALLY<i> that there is something to pay attention to and usually the note indicates it is a patch, a kludge, or a less than optimal solution.
Other sorts of comments that might not look so good might include:
<ecode>
' [initials_deleted] - [date]
' THIS IS A FIX - we're holding off on implementing it, despite the fact is is the
' correct fix, in order to get the [version] release out the door. Default is [value]. This
' means we are writing the wrong thing into the DB. Yet, at the same time, if we fix
' it now, it means more work to fix and more risk. So, we want to fix it, we want to
' see this change in place, but not right now. So I'm leaving it here, but commented.
'[line of code commented out]
</ecode>
I guess I've written a few comments late at night that I usually excise when the code goes into the repository for the builds. I remember some that crept through. A follow on developer asked me about a comment where I had written "I have no #$%! idea what this value is meant to be so it is utterly arbitrary...." (relating to line discipline for systems we didn't have specs on).
Similarly, I've seen comments like "If you get here, we're TU" (Tits Up).
I have seen supposedly benign test data that was never designed for primetime leak out to customer sites. I've seen error messages that said "You should never see this error message. If you do, you're in a very bad state." pop up at client sites. This kind of stuff happens, so beware that any test data you enter should at the very least not be offensive - funny is okay, but humour can be in the eye of the beholder. I'm sure the [deleted] police agency would have been happy if the easter egg we joked with at the office (an avi of a pig squealing) had actually made it into the final release so that every time someone hit request-to-talk, that noise played on the laptop. Some officers we showed it to broke up laughing, but I'm sure others would have been hugely pissed off. So whenever you do something you don't think will get out, keep in mind, it on
-- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
the CDDL specifically prohibits me from learning anything from looking at the OpenSolaris code.
:) Note that patents are applicable regardless of whether you have looked at the code implementing them. Even if you don't know about the patent, they still apply. (However, willfully breaking a patent tends to result in higher damages).
This is untrue and absurd.
Because its covered by a "file-based" license, I can either take files in full, or not at all.
This is again untrue.
The CDDL licence allows you to modify CDDL code, as long as the resulting file is CDDL licenced. So you can take a file, strip out stuff you're not interested in and use that (under the CDDL licence).
I am not covered by the CDDL (and would be in violation of it) by taking snippets of code from any of the files,
This is untrue.
You may take CDDL code and use it as you wish, provided the resulting file is also CDDL licenced. You can have your code link to this CDDL code, and your code can be under whatever licence you like.
including viewing them and "paraphrasing" what I learn back into my own code.
Untrue.
You are allowed to do this, provided that the files which were modifications of CDDL code stay under the CDDL. Your own code you may licence as you wish. If rather you mean that you want to "steal" CDDL code, modify it and bury it in your own proprietary licenced application well, sorry, no, you can't do that - no more than you could with MPL or GPL licenced code.
Also, there ARE patented concepts in the OpenSolaris code, which you are welcome to use, as long as you use entire files (i.e. covered by the "file-based" license).
Correct, and you may also modify those files, provided the modified files are made available under the terms of the CDDL.
I don't want to put any of my clients or projects at risk, so I can't look at the code.
At risk of what exactly? Your tendencies to want to take other people's code and relicence it? Your email address says '@gnu-designs.com', but I wonder if actually you're a BSD licence fan.
So nope, I haven't even looked at the code, because frankly, I can't, without contaminating my own code and ideas.
Looking at CDDL code is not going to do that.
Note that copyright does not disallow you to look and reimplement. Note further that not looking does not protect you against patent claims.
If you truly were concerned about protecting your clients from patent risks in your own code, then your safest bet would be to take the CDDL code and link to it: with your own code under whatever licence you want, the CDDL code implementing the patent and providing you and your users with a grant to use the patent.
You havn't fallen for the FUD put about by a certain libc hacker have you? (Who just happens to work for a competitor of Sun's? Pure coincidence of course..).
I use Friend/Foe + mod-point modifiers as a karma/reputation system.
Linky
Javascript + Nintendo DSi = DSiCade