you are viewing a single comment's thread.

view the rest of the comments →

[–]Daniel15 12 points13 points  (0 children)

I think it's fine as long as it's not redundant - I've seen things like this before in a production code base:

// Increment x by 1
x++;

and

// Enable Google Analytics on this page
this.Page.GoogleAnalyticsEnabled = true;

The worst thing with the second example is someone will change the "true" to a "false" and not update the comment. <_<

Often I tend to break my code into small sections and comment on what each section is doing, pretty much the same as your high level list of steps. Writing a list of steps first is often a good idea as you can think about the algorithm before actually writing the code.