This question has been obsessing me for the past 2 months.
A while ago a friend who is a great programmer gave me some example codes, and for the first time I've noticed a unique style of organizing comments. He took some effort to design comments in a way that would make me more comfortable with the code itself. For example:
///////////////////////////////////////////// // // // This code prints a basic "Hello world" // // message to the console screen. You can // // change the text in the brackets. // // // ///////////////////////////////////////////// #include <iostream> int main() { cout << "Hello world"; } when he could have simply written
/* This code prints a basic "Hello world" message to the console, change text in brackets */ #include <iostream> int main() { cout << "Hello world"; } This kind of example only on a bigger scale. I find this a little unproductive in professional situations but in a learning situation, it seems ideal.
The question here is, if comment style affects how the reader understands code. In my personal opinion option #1 is prettier to the eye and easier to follow than #2. Does the way you comment on code affect ones ability to comprehend your code, or is it just wasted time and space?