S
SurvTest
Back to Blog

AI-Generated Code Comments: Are We Drowning in Useless Verbosity?

2026-03-01About Author

The Promise (and Peril) of AI Commenting

Oh, the siren song of effortless documentation! AI tools promising to automatically generate code comments are popping up faster than JavaScript frameworks. The idea? Reduce developer workload, improve code maintainability, and generally usher in a golden age of well-documented software. The reality? A tsunami of verbose, often pointless, explanations that obscure the actual code.

Let's be honest, most code comments are already terrible. Either they parrot the code ('i = i + 1; // Increment i'), are hopelessly out of date, or are so cryptic they require a PhD in ancient Sumerian to decipher. So, what happens when you unleash an AI on this already murky landscape? You get…more terrible comments, just produced at scale.

Problem: The Verbosity Vortex

The core problem is that current AI comment generators prioritize quantity over quality. They aim to explain everything, resulting in comments like this:


// This function takes an array of numbers as input and returns the sum of all the numbers in the array.
function sumArray(numbers) {
  // Initialize the sum to 0
  let sum = 0;
  // Iterate over the array of numbers
  for (let i = 0; i < numbers.length; i++) {
    // Add the current number to the sum
    sum += numbers[i];
  }
  // Return the sum
  return sum;
}

Congratulations, AI! You've perfectly described what the code does, but you haven't explained why. Any developer who can't figure out what `sum += numbers[i]` does probably shouldn't be writing code in the first place.

This isn't helpful; it's actively harmful. It clutters the code, making it harder to read and understand the important parts. It increases cognitive load, forcing developers to sift through mountains of text to find the actual insights they need. It's the software equivalent of someone constantly narrating your life: 'Now you're reaching for the coffee cup. Now you're taking a sip. Now you're grimacing because it's burnt.'

Solution: Context-Aware AI, or Just...Good Developers?

So, what's the solution? Well, short of teaching AIs to develop a sense of humor (which I suspect would lead to even more sarcastic and unhelpful comments), we need to focus on context. The AI needs to understand the broader purpose of the code, the design decisions that led to its current form, and the potential pitfalls that developers should be aware of.

Here's what a *useful* AI-generated comment might look like (assuming `sumArray` is part of a larger financial calculation):


// sumArray: Calculates the total value of a transaction.
// Note: This function assumes all numbers in the array are in USD.
// Ensure currency conversion is handled upstream if processing transactions from other regions.
function sumArray(numbers) {
  let sum = 0;
  for (let i = 0; i < numbers.length; i++) {
    sum += numbers[i];
  }
  return sum;
}

See the difference? Instead of explaining the obvious, it highlights a crucial assumption (currency) and provides guidance on potential issues. This is the kind of information that saves developers time and prevents bugs.

  • Train AI on high-quality, human-written comments: Garbage in, garbage out. If you want the AI to generate useful comments, feed it examples of good comments. Look at well-documented open-source projects for inspiration.
  • Focus on 'why,' not 'what': The AI should explain the reasoning behind the code, not just describe what it does. This requires a deeper understanding of the code's purpose and context.
  • Allow developers to edit and refine AI-generated comments: The AI should be a starting point, not the final word. Developers should be able to easily edit and improve the comments to ensure they are accurate and helpful. Think of it as pair programming...with a slightly dimwitted AI.
  • Consider disabling AI commenting for simple functions: Sometimes, the best comment is no comment at all. If the code is self-explanatory, don't clutter it with unnecessary explanations.

The Harsh Truth

Maybe, just maybe, the solution isn't better AI, but better developers. Developers who understand the importance of clear, concise, and context-aware comments. Developers who take the time to explain their code, not just write it. Developers who aren't afraid to delete a comment if it's no longer relevant.

Until AI can truly understand the nuances of software development, we're better off relying on human intelligence (and a healthy dose of common sense) to document our code. After all, a well-crafted comment is a love letter to your future self (and your colleagues). Don't let AI turn it into a rambling, incoherent manifesto.

So, before you blindly embrace AI-generated comments, ask yourself: Are you actually improving your codebase, or just drowning in a sea of useless verbosity? The answer, I suspect, is often the latter.

AI-Generated Code Comments: Are We Drowning in Useless Verbosity? | AI Survival Test Blog | AI Survival Test