Thursday, January 25, 2007

Commenting fields/methods

Less comments but more content.

Along with methods, if a field has to be commented, I’ve found it is usually because it is misnamed.

// Counter that keeps track of login attempts private int counter;

Would be better expressed as: private int loginAttemptCounter;

It is funny how this simple DRY concept can keep you on the high road of development. Also important is spell-checking and grammar. While a comment shouldn’t be an English thesis paper it should be professionally written. If English is not your strong point have a buddy on the team review your code for errors. Even the best authors lean heavily on editors (the human proof-reading kind not the text-editing kind).

No comments: