2007-09-13

Ghostdoc

A friend and I collect things that counterwork their own purpose.

One of them is GhostDoc which among other things tries to figure out comments to write for your methods.

Example:
public void GetUserByUserID( int userID )...
would probably render a comment like
///<summary>
///Get the User of the specified userID
///<summary>

///The user ID.
///<parame name="userID">The User ID</param>


Let's say the method does exactly what it look like. No side effects or strange behaviour due to historical reasons at all. Why do we need a comment for then?
Ok, a correct comment does not damage anything.
But consider if it is not totally correct. It only gets active users, it returns null if a user is not found, userID = 0 does something or userID = -1 does something else. Then GhostDoc created a comment that is wrong.

The base fault here is that the programmer didn't comment his method at the first time. We can blame him but hand up anyone who hasn't forgotten to comment a method. So this is not a valid excuse.

There is also no way of telling the automatically created comments (that might need a check) from the manually entered comments (that also might need a check but at least are not automatically inserted with faults)

What GhostDoc does wrong is to enter possible new comments that are wrong, to enter false information to a program. And this is done automatically.

Update: I just found Bumblebee that does approximately the same.

No comments: