Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting question

 
Norman Leach
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, here's my question.
I have been in the habit from C++ of denoting the ends of my blocks in the following manner:
if {
blah, blah, blah
}//end if
while {
blah, blah, blah
}//end while
in my assignment 1.1 nit-pick, it was felt i had too many comments stating the obvious that made the whole program harder to read.
Now, I'm going to take them out for the purpose of these assignments but to me, comments like that make it easier to debug the code later when i'm trying to make sure all of my blacks have been properly terminated. Anyone have any feelings/comments on this?
Norman
 
paul wheaton
Trailboss
Pie
Posts: 21478
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My thinking is that if you have to put those comments there in order to make your code readable, your method is way too big.
The more comments you add, the more there is to read to figure out what is going on. The more there is to read, the less readable the code is. So the art is to write your program in such a way that it is easy to figure out without comments. If you need comments, don't over do it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic