Comment As You Code

Comment As You Code

Benefits of Commenting As You Code

Habits are powerful, and good commenting habits will let you craft excellent documentation with minimal effort. Get in the habit of writing comments before or during actual writing of code. There are several benefits to this:

  • Writing comments - both MAJOR and minor comments (which we’ll get into) - before jumping into coding can help you detect problems earlier when they’re less expensive to fix.

  • If you comment "immediately", the information is fresher in your mind, so you can write better comments without forgetting important details.

  • Commenting as you code helps ensure that comments remain up-to-date as code changes.

  • When you’re “done” with the code, you’re basically already done with the comments.

  • If using AI coding assistants integrated into your IDE/editor, comments can help guide the assistants to auto-completing code closer to what you’d like.

Say goodbye to blindsided code updates ad.png

Tips for Commenting As You Code

See the following sections for more practical details on commenting as you code: