Thursday, January 20, 2011

Article on source code commenting

There are some good points in here about commenting code. Some fairly obvious.

It does suggest one idea to me that is not covered. If comments on one hand are not part of the run-time construct, while source code is completely part of the run-time construct, what are unit tests and asserts?  They are intermediate between comments and source code. They make assertions that can be interpreted as meaningful commentary on the program, although sometimes cryptic and wrong.

The point being that they are both parsed and evaluated, while not being part of the final run time construct (obviously you could come up with scenarios to prove this wrong... but that misses the point)

I would contest that there is a spectrum between comments, tests and asserts and source code. With human readable at one end and the final compiled construct at the other.  Everything has meaning but there are still differences between what is intended vs what is actually happening in some code.

No comments:

Post a Comment