Hacker News new | ask | show | jobs
by squeaky-clean 1675 days ago
If I ever have to solve something especially weird and use a stackoverflow result, I leave a comment above the weird code linking directly to the stackoverflow answer. And usually some extra context if the stackoverflow question isn't a perfect replica of our situation.
1 comments

I do this too, just so I can refer back to it when I inevitably forget what exactly I did.
A highlight of my development career thus far is when I was able to fix a build that happened to be broken on a colleague's machine, which had stumped three other developers for multiple hours spread across a week.

I don't remember the line of reasoning or detailed investigation that led to the solution, but I found something in a build configuration file that looked suspicious enough to warrant a search for an exact phrase in the code. It turned up a StackOverflow answer, where three lines had been cut and pasted into the build file.

There was some specific change in a library or binary upgrade that had broken the thing that this particular change was meant to fix, and the problem was solved by removing the lines in question.

The commit comment for these three lines was "merge hmmmm", which was also the only local documentation I found that I could have used to cross-reference with anything else.