Frank W. Zammetti wrote:
Well now, *this* is a good way to go off-topic in a hurry Dave! :)
I'm sorry, I have a cold. (Marginally obscure Monty Python reference.
Every OT post needs one.)
I didn't mean to start a debate here?
I personally feel just the opposite... the more comments the better, and I
don't generally care how "pointless" they are... well, ok, if I see:
a++; // Add 1 to A
byte[] bytes = new byte[1024*1024]; // some maximum size
int byteSize = pictureStream.read(bytes); // read in the bytes
*oh, so _that's_ what 'read' does*
byte[] bytesX = new byte[byteSize]; // create a new array of
*oh, so _that's_ what 'new' does*
the proper size
for(int i=0;i<byteSize;i++) { // copy them into the new array
*oh, so _that's_ what '=' inside a loop does*
bytesX[i] = bytes[i];
}
pictureBytes = bytesX; // assign it to the form variable *wait,
I already know what '=' does, but this isn't in a loop*
}
But all those *are* "add 1 to A" comments.
Besides the fact that the copy chunk should be refactored, you could
comment the entire block of code by saying "copy input stream to form
variable."
And I generally would use either an accessor or some sort of "this is an
instance variable" marker (like _pictureBytes or whatever) to remove one
more needless comment.
I like comments (love 'em!) but commenting every line in a 5-line chunk
of code is... silly. This example is obfuscating rather than clarifying.
String s = s1.toUpperCase().trim().replace('A', '-');
Now, that's pretty straight-forward. But, if someone added a comment:
// Convert s1 to all upper-case, trim whitespace from both ends and
replace all A's with -'s and store result in s
There's some sort of limit function here. As comment character count
approaches code character count something horrible happens. My head
explodes, and maintaining the comments becomes more cumbersome than
maintaining the code.
This is coming from someone that comments rather heavily, but sensibly.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]