File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes Formatting question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Formatting question" Watch "Formatting question" New topic

Formatting question

Norman Leach

Joined: Jan 05, 2001
Posts: 17
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?
paul wheaton

Joined: Dec 14, 1998
Posts: 20965

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.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
I agree. Here's the link:
subject: Formatting question
It's not a secret anymore!