No matter what you do, this kind of function is going to be about 3 lines. It needs a good 30-60 lines of comments explaining what the problem was, why this solution is better, and demonstrating other solutions that didn't work as well. Furthermore, it should probably contain the URL to this thread so that future readers of your code can find the people who made the suggestions (
Thelonius++) and make their own conclusions.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?