Cogman
Lifer
This thread got so much deeper than I ever expected.
🙂 given a sufficient amount of time, any thread in the programming forum will eventually degrade to compiler optimizations and assembly :awe:
This thread got so much deeper than I ever expected.
I begin most of my work by writing the layout of the algorithm in comments, and then write the code in-between. That usually makes it easy to avoid the traps of bad comments. Comments have to EXPLAIN what you do, not DESCRIBE it.
It also depends on the complexity of the code as well. If the task was to write a 100 line simple sort or search algorithm, there really is no need to comment inside the code, that code should be pretty self documenting.
Other examples are event handlers that serve simple functions, such as a page redirect or a click event, or mouseover event, etc. The structure of the method is pretty much self documenting