Re:Minimal Advice to Undergrads on Programming
by russell on Saturday December 27, 2008 @03:38PM
(#411327)
I always add a one or two sentence description for a method and reference book or url if it implements a particular algorithm. I go for the meaningful names approach and document parameters and returns when meaningful isn't enough. I try to keep methods short enough that internal comments aren't usually needed.
If there are assumed states or input ranges, asserts are better than comments. Comments drift out of correctness, asserts don't.
I try to design data and configuration files with comments and then comment them with field descriptions and examples.
If there are assumed states or input ranges, asserts are better than comments. Comments drift out of correctness, asserts don't.
I try to design data and configuration files with comments and then comment them with field descriptions and examples.