Welcome to EMC Consulting Blogs Sign in | Join | Help

Anthony Steele's Blog

Comments and documentation that add value

Here's an extract from the help file for a third-party product that we're using.

public Int32 NumberOfRows {get; set;}
Gets or sets the number of rows.
Property Value: The number of rows.

Here's some source from a project (names changed)

        /// <summary>

        /// Gets or sets the factor of the foo.

        /// </summary>

        /// <value>The factor of the foo.</value>

        int FooFactor

        {

            get;

            set;

        }

Comments like this are just annoying. If you need help on how, when or why to use the Foo factor  you're plain out of luck – but you will find out, in case you hadn’t already worked it out, that NumberOfRows contains the number of rows. 

Comments and documentation like this add no value at all; they also take up space and take time to read. So they are slightly worse than nothing at all. More generally, if something adds no value at all to the code, strongly consider removing it.

How do comments like this come about? I can see someone unthinkingly doing this because they see it done elsewhere and assume it's good style. It would have to occur in the first place because marking off of the item "we have a comment/we have documentation" was more important than actually imparting any information of value to anyone.

Howard has pointed out that some tools generate comments and documentation like this. Skeletons are useful, but only if you plan to put flesh on them.

Published 11 December 2006 13:27 by Anthony.Steele

Comments

 

howard.vanrooijen said:

Sounds like something GhostDoc would spit out: http://www.roland-weigelt.de/ghostdoc/

December 11, 2006 17:09
Anonymous comments are disabled

About Anthony.Steele

Programmer in c# for Conchango

This Blog

Syndication

Powered by Community Server (Personal Edition), by Telligent Systems