tags:

views:

96

answers:

3

Possible Duplicate:
What did you do to develop good code designing practices

There are two different situations.

  1. you read someone's code, and you know what they are doing intuitively.
  2. you read someone's code, even there are many comments, but you really don't know what he wants to do.

I wonder whether or not there are best practices that help people to write elegant code for other body to know?

+1  A: 

Don't run a single line of code on too long. Neatly tab blocks of code. Provide sufficient commenting when necessary.

Jonathan Sampson
+2  A: 

Comments (other than XML documentation comments at the class/method level) are generally a code smell. Replace them with a method whose name reflects its intent.

See http://www.codinghorror.com/blog/archives/000589.html

There's a whole chapter in the book Clean Code on comments. Most of it's negative.

TrueWill