Are first person comments distracting and unprofessional

coding-standardscomments

I just found myself writing the following comment in some (archaic Visual Basic 6.0) code I was writing:

If WindowState <> 1 Then
    'The form's not minimized, so we can resize it safely
    '...
End if

I'm not sure why I subconsciously use "we" in my comments. I suspect it's because I imagine someone stepping through the code, as if they were actually "doing" all of the commands on each line, rather than just watching them happen. With this mindset, I could have used I can resize it, since I'm the one "doing" it currently, or you can resize it, as if I were speaking to whomever is "doing" it in the future, but since both of those of these cases will most likely happen, I use "we" as if I'm leading someone else through my code.

I can simply rewrite it as it can be resized and avoid the issue, but it's sparked my curiosity: is it common to use first person like this in comments, or is it considered distracting and/or unprofessional?

Best Answer

Comments should be written for human beings to understand. When human beings communicate, we typically use "I", "we", "you", etc.

When someone is trying to understand some code, there are two or more actors: the person reading it, and the original author of the code. Saying "we" is fine. Unless by 'professional', you mean 'robot-like'.

Related Topic