Skip to content

Good Comments

20080802 (2008 August 02 Saturday)

When trying to follow Comment-Only-When-Necessary; some times, because of limitations in the programming language, it may be impossible to express your intentions with out comments.

Therefore, follow Comment-Only-When-Necessary, but where necessary follow the following.

Times when comments are necessary

  • In C++, Java or C# … Before a constructor, as they are hard to find: //constructor
  • At a closing brace, if a long way from opening one //end if|for|method|class|etc ……, but try not to make blocks to long.
  • Design-Contracts-In-C++And-C or C# in Pure-Virtual methods.
  • To express why. (Use good symbol names and Design-Contracts to express what. Use simple code for how)
Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: