In quite some codebase you can see comments stating things like: // Workaround f
ID: 639193 • Letter: I
Question
In quite some codebase you can see comments stating things like:
// Workaround for defect 'xxx', (See bug 1434594 on Sun's bugparade)
So I've got a few questions, but they're all related.
Is it OK to put link to SO questions in a program's comments:
// We're now mapping from the "sorted-on column" to original indices.
//
// There's apparently no easy way to do this in Java, so we're
// re-inventing a wheel.
Do you do it?
And what are the drawbacks in doing so? (see my first comment for a terrible drawback)
Explanation / Answer
I've done it, maybe not specifically for Stack Overflow, but for technical blogs, forums, Usenet, Google Groups, or any other places where the "why did I do this" may not be completely clear from the context.
I don't see why using SO like this would be a bad thing, unless they archive and purge off old questions (which I don't think they do, but I'm not sure) - but even if they do, it's no worse than any other site.
If you're really worried about that, you can always take screenshots or download these pages as text (or go through the trouble of getting the images, stylesheets, etc.), and saving them to a knowledge repository at your company, attaching a unique identifier to it, and putting that unique identifier in your comments to allow you to reference later - then you'd have a consistent place for this type of thing. But that may be overkill, depending on the complexity and importance of your code.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.