Posted by: tfabris
Coding standards. Periods at end of *some* comments only? - 09/06/2015 16:18
At my new job, they are very particular about coding standards, and in code reviews I'll be given a comment if my code doesn't follow their standards.
I think think this great actually, because their standards are clear, and all of the standards make for better code and more readable/maintainable code.
But there's one standard which confuses me, and it seems counter intuitive, so I keep messing it up. Can someone explain to me the reason that someone might adopt such a coding standard, what the psychological reason might be for it?
The standard is:
- If you have an HTML comment for a class/method/property using the triple slash, your sentence MUST end with a period.
- If you have an inline comment for miscellaneous body code, using the double slash, then your sentence MUST NOT end with a period.
I keep messing this up because I like to type proper English sentences (well, as proper as we can get in America anyway). If there is a way I could wrap my brain around WHY, then maybe I'd mess it up less often. Any ideas?
I think think this great actually, because their standards are clear, and all of the standards make for better code and more readable/maintainable code.
But there's one standard which confuses me, and it seems counter intuitive, so I keep messing it up. Can someone explain to me the reason that someone might adopt such a coding standard, what the psychological reason might be for it?
Code:
/// <summary> /// Removes the file. /// </summary> public static void RemoveFile() { try { // Check if the old file exists if (File.Exists("file.txt")) { // Delete old file from disc File.Delete("file.txt") ...
The standard is:
- If you have an HTML comment for a class/method/property using the triple slash, your sentence MUST end with a period.
- If you have an inline comment for miscellaneous body code, using the double slash, then your sentence MUST NOT end with a period.
I keep messing this up because I like to type proper English sentences (well, as proper as we can get in America anyway). If there is a way I could wrap my brain around WHY, then maybe I'd mess it up less often. Any ideas?