Comments

March 16th, 2003

Short comment on this: JavaBear

  • Put your comment on the appropriate level. Implementation details don't belong in the method's javadoc, but maybe in the method's comment. "The counter i is increased with 2 each time because..." does not belong in the method's comment.
  • Don't only comment why, but also what. Have you never encountered some string manipulation code, that forced you to execute it in your mind before you figured out what it does? "This removes every third character from the string, but keeps the last 6, the middle 4, and deletes the first 3" might prove very time-saving.

Now moving on, discussions like this become very fast very boring. But I couldn't resist.

Leave a Reply