Code Comments Say What?

I came across another sentence in Professional WordPress Plugin Development that made me stop and think for a minute:

The major benefit to code commenting is to explain what your code actually does, in plain English.

The triggering word being what.

I always believed that code comments should say why. What should be easy to discern from good code, without the need for additional commentary.

I’m using this rule of thumb for code comments:

Code says what, comments say why.


  1. Just visiting says

    If the comments have to say why, then something might be wrong with the code. Don’t you agree?

Leave a Reply

Your email address will not be published. Required fields are marked *