News for hackers. Stuff that matters.
Re:Document the Why by jtheory on Wednesday March 06, 2013 @11:29AM (#5331967)
My primary rule for commenting is to document anything likly to be unexpected or counter-intuitive to someone else on their first read of the code.

You don't always need to "document the why", because often it's obvious enough (with a well-named hierarchy of code, method names, etc.)... but it's essential to get a feel for times when someone else will see your code doing Y and think "ah, this would be easier if we just do X", and comment those carefully.

Related: read other code; get a sense for common programming idioms, and use the common approaches unless you have a really good reason not to.

You may be proud to have mastered a little-used feature in your language of choice that saves you a line of code here and there, but if the cost is that 80% of the people reading your code later are confused, you're not winning.

Re:Document the Why by ZoFreX on Wednesday March 06, 2013 @04:31PM (#5334113)
> You may be proud to have mastered a little-used feature in your language of choice that saves you a line of code here and there, but if the cost is that 80% of the people reading your code later are confused, you're not winning.

What if it's a feature little-known within your team, but considered common or even idiomatic in the wider world?

Re:Document the Why by jtheory on Friday March 08, 2013 @07:47AM (#5343104)
Then take the time to teach them about it, and why it's worth picking up.

Everyone wins in that scenario.