DEV Community


Discussion on: The Importance of Quality Comments

adrientorris profile image
Adrien Torris

Good article.
However, an important point with the comments to me is they have to explain what, but most important, why. If the code is nicely coded, you can easily understand what the code does, but the most important thing is to understand why. Why the developer tests this variable ? Why the developer uses this function to do this and not another one ?

There is a good example, in my point of view, in your example. The fourth comment is : "Check if the team has reached the limit or not". It's explain what the code does, but not why. If you want understand why the developer has written this test, you have to read the code until reading the returns message : "Daily log limit reached", so the comment is not that good to me. A good comment would be : "Check if the team has reached the limit or not, cause we have a daily log limit, due to small-size disks"

But we totally agree on the important point of this article, comments are a critical issue and an important part of a developer's job.

Forem Open with the Forem app