> If I don't do this, when I come back to the code an hour later
Good coding means two things, in general:
* There is no more understandable comment than no comment needed.
The code should explain _what_ it is doing as close as possible in words such that any programmer, including you, can read the code and understand what it is doing.
* Comments should be the exception for _why_ something odd is happening.
Bad: if(r == 42) return; // Nothing happened.
Good: if(ioReturnCode == 42) return; // Ignoring code 42, an undocumented value and seems to be a "no operation happened." We'll retry again later in the code.
Good coding means two things, in general:
* There is no more understandable comment than no comment needed.
The code should explain _what_ it is doing as close as possible in words such that any programmer, including you, can read the code and understand what it is doing.
Bad: sum = a.length + b.length
Good: totalNumberOfGoodProducts = exceptionalProducts.length + acceptableProducts.length
* Comments should be the exception for _why_ something odd is happening.
Bad: if(r == 42) return; // Nothing happened.
Good: if(ioReturnCode == 42) return; // Ignoring code 42, an undocumented value and seems to be a "no operation happened." We'll retry again later in the code.