04.21
There’s a lot of maintenance of code on my current project. The code is not always of a very high standard (ok, so that’s being nice!). One of the things that annoys me is where code comments are pointless, and are glibly added without any thought to their purpose.
Here’s an example of a poor comment:
//function function will call the various functions depending on the selection that was made
addProgrammes( ctlFlexTable, xaxisf.AsString() );
Of course, and to be fair, there are slightly more useful comments:
// — Add a total row —
row = new MIS.Tables.Rows.TotalRow( ctlFlexTable );
On the whole, I feel that comments should be used in source code to highlight the purpose of a piece of code, where that purpose is not immediately apparent. Also, comments can be used to explain functionality where that functionality is not obvious.
Andrew.