1. React
  2. JSConf Hawaiʻi
  3. 2020
  4. The Art of Code Comments

The Art of Code Comments

Commenting code is a more nuanced thing than we give it credit for.

Sarah Drasner at JSConf Hawaiʻi 2020

Commenting code is a more nuanced thing than we give it credit for. There are a couple of schools of thought on this. One states that if you feel a comment is necessary, you should rewrite it to be more legible. This is true. But it's also not true. In the process of writing a comment, you can often find things that could be written better, but it's not an either/or, for the following reason: Code can describe how, but it cannot explain why. There is just not one right way or one reason to write a comment.In this session, we'll dig into some of the many beneficial types of comments that might all serve a different purpose, followed by patterns we might want to avoid. In the process we'll talk about being good teammates, collaborating, and writing the most legible code we can.