|
|
|
|
|
by rcvassallo
4960 days ago
|
|
OP make a good point that comments help to make your intent more clear, while the code itself just explains what the program does. Very good reason to have some comments here and there. But I'm with Toshiro - test your damn code! Testing first brings all the benefits of commenting and more: Tests help document and clarify your intent. They convey your assumptions, expectations, and show you exactly how methods are expected to behave when you run the test. 3 months later when you're adding new features, a failing test tells you that you introduced a bug before you ever run the new code. That said, comments have a place in the tests themselves. Much better than scattering comments all around the code base. The other place for comments is in the version control. Make small, frequent commits and set up your version control so that it forces you to comment each time. When you're doing these things, comments in other parts of the code are just redundant and noisy. |
|