DEV Community

Discussion on: Is Commenting Code that necessary?

Collapse
etienneburdet profile image
Etienne Burdet

It's language/framework dependant and the old "Comment everything" is… getting old and poked fun at.

Modern languages, framworks and overall practice makes code much, much easier to read and understand. But I remember scientific code in C (or crazy ad-hoc languages): they are cryptic at best. So descriptive comments were necessary to decipher the thing.

For modern JS, Rails, Python etc. they should be only for the non obvious part and focus more on the "why". Typical exemple include what is returned by a required module or library, or why you wrote that helper function where it is used etc. But descriptive comments like "this function does that" should be a warning, if anything.

Collapse
aashrithashiva29 profile image
Aashritha Shiva Author

Yes. Exactly even I meant to say it !!
Identification of right places and intent to write a comment and keeping it clean and informative (like u mentioned in the last lines) is important...
Thanks for this comment :)

Collapse
etienneburdet profile image
Etienne Burdet

By the way I forgot, but a good README also greatly reduce the necessity for comments.

Collapse
aashrithashiva29 profile image
Aashritha Shiva Author

Yeahh .! 👍 It must clearly give the view of entire project!!