[snips]
Because I'm a curious kind of creature, I decided to search the entire
Linux Kernel source code for instances of "kludge" and "FIXME". And here
is what I found:
kludge: 154 occurrences
FIXME: 3120 occurrences
These results seem rather striking to me. After all, the Linux Kernel
source is "open source", and, frankly, I expected to find 0 occurrences
of both these search strings, given that we should have multitudes of
programmers working on this source and fixing the bugs in what I pretty
much expect should be real-time.
Because I'm a curious kind of creature, I decided to search the entire
Microsoft MFC source code for instances of "kludge" and "FIXME". And
here is what I found:
kludge: 0 occurrence(s)
FIXME: 0 occurrence(s)
At this point, I'm feeling pretty damned hoodwinked. That desktop
graphic of the penguin sucking on a cardboard drink container with the
Windows XP logo and the words "We suck more!" on it look really
appealing, but what is really behind all that--just a dog-and-pony show?
My C question is the following:
Is it good practice to comment our code with words like "kludge" and
"FIXME"?
If so, what does that say about our requirements in specific, and our
development process in general?
In any large-scale development project, there will typically be boatloads
of things which need fixing or are kludges. This is the way of the
world. Nor is this necessarily a terrible thing.
One piece of code I wrote many moons back involved about six lines of
code, which, when examined, should have had no actual effect whatsoever.
The fact they did was due to an immensely obscure bug in the firmware of
a modem the code was controlling. While the mechanism I came up with did
work, I was quite convinced there was a better way - if we had more
information on the modem. Hence, it got a KLUDGE tag - but it also made
it to the release version. Why not? After all, it worked, it was
effective, it was just ugly.
Some of those kludges may stick around a hell of a long time, too, for
the simple reason that while they may be ugly, they work, and other
things are more important.
The same might be true with a FIXME as well. Consider, oh, a driver. To
get best performance, you might want to set the device into a particular
operational mode - but not all devices might like that. Any which are
identified as "can't do that" might get blacklisted, set to run in a less
than optimal mode.
This is probably acceptable insofar as the system _works_. That said, it
would be better to figure out what other systemic changes need to be made
to get the device running at peak, but this may involve significant
changes to several other important pieces of code, something not to be
done casually.
Such a case would definitely warrant a FIXME, IMO, as it means you're not
operating as you should be - it's not simply ugly, it is actually
defective - but until you figure out a workaround and patch all the
affected areas, it at least works.
So what should one do in such a case? Say no, sorry, we won't support
that device at all? Not good. How about holding off release until the
device is fully supported? Possibly an option, but if the hardware
vendor isn't helpful, it could mean a potential delay of years or more
before release.
The best answer seems to be to bite the bullet, release it as it is -
optimal on most devices, suboptimal on others - but note, in the code,
that this really needs to be fixed.
Ain't nothing wrong with that. FIXME and KLUDGE and the rest are only
worrisome if they involve something where there's a really fundamental
failure or there is a comparatively trivial fix - but this is not,
generally, the case in code such as the Linux kernel.