Technology1 min read

Representative Line: What it Doesn't Do

By · Published by Everything Blog

In short

While inspecting a codebase, software developer Alastair spotted an unusual note attached to a function labeled "getAllMailers." The advisory warned future engineers that the logic neither returns Mailers nor all of them. A review of the file's revision history showed that Alastair himself had authored the cautionary remark. Despite documenting the discrepancy, he had not written the code itself, leaving the actual purpose and return value unresolved.

Key points

  • The actual data returned by the misleadingly named function remains entirely unknown to t…: The actual data returned by the misleadingly named function remains entirely unknown to the team.
  • Alastair authored the cautionary note despite having never written the underlying impleme…: Alastair authored the cautionary note despite having never written the underlying implementation of the code.
  • Mismatches between functional labels and underlying code can persist even after being ide…: Mismatches between functional labels and underlying code can persist even after being identified and documented.

Sources checked by our analysis pipeline: 1

Alastair found this comment in his codebase, and wondered, "who wrote this comment?" A quick blame

answered the question: he did. He did not, however, write the code.

public function getAllMailers() {

// This function neither returns Mailers, nor all of them.

...

}

I suppose the comment was easier to add that doing a global find/replace to update the function name everywhere. But I do wonder, what does this function return?

In any case, sing along: "I wrote the comment, but I did not pick this function name".

[Advertisement]

Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

Technology