Quick Guide to using Vanus AI Code Commenter Template

August 8, 2023 6 min read
Jamillah Bello
blog image

Table of content

Introduction

Certain individuals might find themselves pondering: what is the rationale behind incorporating comments into our codebase? What precise role does it fulfil? It is worth noting that comments, in themselves, do not exert any direct influence on the code’s functionality or execution. So why bother? Well, think of coding as writing a recipe for your computer to follow. But imagine if you wrote the recipe, and then later you forgot why you included some ingredients or steps. That’s where comments come in.

Comments are like little reminders you leave in your code. They help you remember why you did certain things, even if time has passed. It’s like leaving yourself helpful notes to understand your own recipe.

Not only that, if you’re working with others, comments help them understand your code too. It’s like sharing your cooking secrets with someone else so they can help you in the kitchen. And just like recipes change over time, code needs updates too. When you need to change something, comments guide you so you don’t mess things up.

So, commenting on your code is like keeping a recipe book that never gets old. It keeps your code tasty and easy to understand, no matter how much time goes by.

Exploring Code Commenter Template

Having grasped the significance of incorporating comments into your code, let’s consider the fate of pre-existing code that you’ve crafted without a clear understanding of the purpose behind certain sections. Picture this: You’re faced with a stack of older code that you never bothered to comment. Now, as you gear up to make edits, you’re left scratching your head over the purpose of certain lines. Also, you’re diving into fresh new code, only to realize you’ve forgotten to include essential comments. If you’re all about staying in the coding groove without the hassle of handling comments, you’re in for a treat. Enter the Vanus AI Code Commenter template, your knight in shining code. Just pop your code into the text box, and it’ll sift through and add the comments you need. Enhancing the experience further, it provides suggestions aimed at highlighting areas in your code that it believes could benefit from refinement.

This tutorial is designed to walk you through the process of utilizing the Vanus AI Code Commenter template. The steps are as simple as copying, pasting, and clicking the “send” button.

User Guide

  • Sign In to Vanus AI Website

  • Click on Try it now on the Code Commenter template and the AI App will be created.

  • To use the AI App, simply click on the Chat tab.

  • Input your code into the text box and click on the send icon.

*For the sake of this tutorial, I entered a Java code functioning as a BMI calculator into the provided text field*

  • The AI App will enhance your code with the necessary comments and display it to you, explaining each line of code.

:::note You can effortlessly copy your updated code by clicking the copy icon located on the right side of the text box. :::

It not only adds insightful comments to your code, but also provides valuable suggestions for enhancing the code quality.

Prompt

  • In the Prompt tab, there are pre-configured messages which provides more information for the AI to learn from.

below are the detailed task steps the AI application follows

Step 1: Identify the programming language.

Step 2: It is crucial to make sure your comments written are properly recognized as comments/annotations in the programming language identified and not interfering with the code functionalities.

Step 3: Write code comments following the best practice rules:

  • Rule 1: Comments should not duplicate the code.

  • Rule 2: Good comments do not excuse unclear code.

  • Rule 3: If you can’t write a clear comment for certain lines and there may be a problem with the code, indicate and explain why the code is unclear in the code comments.

  • Rule 4: Comments should dispel confusion, not cause it.

  • Rule 5: Explain unidiomatic code in comments.

  • Rule 6: Add indication in comments whenever a bug emerges.

  • Rule 7: Use comments to mark incomplete implementations.

Step 4: There are three types of comments: Header Comments for the entire code snippet to explain the overall purpose of this code snippet, Header Comments for individual functions to explain the purpose of the function, and In-line Comments for individual code lines to explain the purpose of this line of code. Both kinds of Header Comments are required. In-line Comments are written only when it is necessary, for example, a line of code worth noting or indications instructed in step 5 and 6.

Step 5: Check again if there is any bugs and improper, not ideal, or incomplete code.

Step 6: Indicate issues you found in step 5 and indicate them as In-line Comment near the problematic code.

Settings

  • In the Settings tab, there are pre-configured settings like the App Logo, App Name, App Greeting & Quick Questions in the general settings.

  • The Application setting: This determines how your AI Application responds throughout interactions.

*Lower value leads to more conservative and precise replies. Higher value may result in more creative responses.*
  • Knowledge Base Search:

Best Results Top N: The number of the most relevant pieces of information returned when retrieving content from the knowledge base.

Best Results Match Threshold: A higher threshold enhances the relevance of the returned text blocks but may reduce the total number of text blocks that can be returned.

  • Delete this app: When the application is no longer needed, you can remove it by clicking on this button.

  • Click ‘Delete’ only if you’re certain you won’t be using this app anymore. Remember, this action can’t be undone.

Conclusion

Adding comments to your code is like leaving helpful breadcrumbs for yourself and others. These little notes might seem small, but they hold the key to unlocking your code’s mysteries, even when time has passed. It’s not just about technology; it’s about teamwork, understanding, and planning ahead. By sprinkling your code with these insights, you’re building a smoother journey for everyone who comes after you. So, as you navigate the coding adventure, remember that these comments aren’t just lines of text – they’re a roadmap to clarity, helping your creations stand strong and understood, no matter how far into the future.

Leverage the Vanus AI Code Commenter template today, to offer comprehensive guidance and a well-structured representation in your roadmap.

Vanus
Platform