I don't know about anyone else, but I like to keep my comments in code nice and consistent. Call me a nerd, but somehow I like to have comments with periods and capitalization in the right place. I wonder if anyone else tends to do this?
-Masoug
Proper Grammar in comments.
Page 1 of 19 Replies - 1421 Views - Last Post: 27 June 2012 - 06:27 AM
Replies To: Proper Grammar in comments.
#2
Re: Proper Grammar in comments.
Posted 12 May 2012 - 05:56 PM
** Moved to Software Development **
#3
Re: Proper Grammar in comments.
Posted 13 May 2012 - 04:08 AM
No, I don't use English grammar in my comments - I use Yoda speak:
// Print a string to the screen this method will. Not call it with a null argument you shall.
// Print a string to the screen this method will. Not call it with a null argument you shall.
#4
Re: Proper Grammar in comments.
Posted 15 May 2012 - 02:54 PM
#5
Re: Proper Grammar in comments.
Posted 17 May 2012 - 04:31 PM

POPULAR
I prefer to use comments to improve the grammar of my code.
/*Define an*/ int/*eger variable to be used as the*/ counter/*.*/;
/*Set the*/ counter = 0/*.*/;
/*Repeat*/ while /*the*/(counter <= 10)/*.*/ {
/*Calculate the*/ int/*egral*/ answer /*as*/ = 2 * counter/*.*/;
/*With the default*/ System. out/*put stream, */.print( /*a formatted*/ String. /*with the*/ format("2 x %d = %d\n", /*substituting the*/ counter, /*and*/ answer))/*.*/;
/*Update the*/ counter /*making it*/ = counter + 1/*.*/;
}
/*Make sure the default*/ System. out/*put stream is */ .flush()/*ed.*/;
#6
Re: Proper Grammar in comments.
Posted 17 May 2012 - 04:48 PM
Haha, that's awesome. Literate programming 2.0.
#7
Re: Proper Grammar in comments.
Posted 17 May 2012 - 05:54 PM
Yes, it's a must. Especially if you're working with complex computations and multiple methods that almost look the same with each other. Or lose your sanity. Your choice.
#8
Re: Proper Grammar in comments.
Posted 19 May 2012 - 01:29 AM
cfoley, on 18 May 2012 - 02:31 AM, said:
I prefer to use comments to improve the grammar of my code.
/*Define an*/ int/*eger variable to be used as the*/ counter/*.*/;
/*Set the*/ counter = 0/*.*/;
/*Repeat*/ while /*the*/(counter <= 10)/*.*/ {
/*Calculate the*/ int/*egral*/ answer /*as*/ = 2 * counter/*.*/;
/*With the default*/ System. out/*put stream, */.print( /*a formatted*/ String. /*with the*/ format("2 x %d = %d\n", /*substituting the*/ counter, /*and*/ answer))/*.*/;
/*Update the*/ counter /*making it*/ = counter + 1/*.*/;
}
/*Make sure the default*/ System. out/*put stream is */ .flush()/*ed.*/;
COBOL reinvented?
I tend to use both full sentences, but also "spoken language" and other notations.
/* Positive? */
if (x < 0)
{
/* No can do */
print_error();
}
#10
Re: Proper Grammar in comments.
Posted 27 June 2012 - 06:27 AM
Of course. This poll is kinda stupid.
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote








|