Wednesday 23 November 2011

Useless comments, useful clean-up

I guess all seasoned developers have come across code containing useless comments.

Some comments are so obvious that they don't deserve their existence in code and when they exist, they are nothing but code pollution.

Examples:
Code Snippet
  1. // Stored procedureName <-- Useless & too obvious comment. Even my grandma could tell that this is a constant storing a stored procedure name
  2. const string storedProcedure = "GetSoftwareArchitectsByCountry";

Code Snippet
  1. // Parameters for the stored procedure <--Useless & too obvious comment
  2. database.AddInParameter(command, "ExecutionCountryId", DbType.Int32, executionCountryId);

Useless comments cause code pollution (too many lines of "code") and require code cleanup which in turns requires time and I think we all agree that time is money. So dear developers don’t waste your effort in writing useless comments… use this time to do other useful things ;)

Cheers,
Shah MOHAMOD