The following articles were originally posted on JRoller, and have as a common theme the code comments.
This first article was posted on August 24, 2005, with the title "Successful comment"
Yesterday, I was looking at some method, trying to understand what it was doing. I decided to look at the comments above the method signature, which might hopefully be of help. What I found was the following line:
// Returns true if successful
Well, that was the only information that I could have found without this help by just looking quickly through the code. Then I asked myself: does it mean that it returns false if the method fails? It reminds me of this story about two mathematicians trying to find out the color of a cow by looking at it grazing the grass from one of its side. If the side they see is white, does it mean that the whole cow is white? Then they agree that the cow is white on its left side.
This second article was posted on March 29, 2006, with the title "When is refactoring needed?"
When you see comments like this one, you know that a refactoring is not too far away:
//Does anything, except storing registry->StoreNetwork();
This last article was posted on October 18, 2006, with the title "Find the root cause"
After eight years in Hungary, I am back to France. I have lots of new code to learn, so hopefully lots of new material for this blog.
Now something about bugfixing. You probably know that if you have to fix a bug, you should look for the root cause, and fix the bug at the root. That's the theory, but there are cases when you just can't do that, and the comment I found in this code is a good example:
if (cd == null) // It can happen. I submit 30 mn before the deadline!
Well, it's OK if you go back later and make a real fix.