Are You Commenting Your Code?

Coding is similar to writing prose. Every individual does it a little differently, and as a result, when our code is read, we all have a distinct voice. Different naming conventions and problem-solving logic exist in all of us. We all think our code makes sense — particularly if it works — but it’s possible that it doesn’t to someone else. To combat this, we all need to get better at code commenting. That way, whoever comes next to the project will have a clear path to understanding and improving/fixing our code.

To begin with, let’s make sure that we’re all on the same page regarding what comments are. In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters. The syntax of comments in various programming languages varies considerably.

Programs must be written for people to read, and only incidentally for machines to execute.

Do you comment the code you write? If you’re like most people, the answer to that question is “No.” But you should! Commenting your code can be helpful in more ways than you might expect.

Here are three reasons why it’s good to comment your code even when you’re studying:

1. Explaining what the code does will help you remember what it does.

2. It’ll help you pick up where you left off.

3. It’s best to form good habits.

comment your code the next time you work on a project. It could help you learn more effectively, and even if it doesn’t, you’ll be building good habits for the future. What are your tips and tricks for getting the most out of commenting your code?

Software Developer in Chicago

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store