• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Formatting question

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic