On 9/29/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > For instance, take this line: > > 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 > > I wouldn't frown upon that for two reasons... one, me looking at it > doesn't have to remember what replace() does (i.e., does it replace ALL > occurances of 'A' or just the first?) and two, it indicates that the > developer who wrote it knew what he intended to do and wrote the code > accordingly.
Way too much for me. The only case I would appreciate comment in the situation above, is when replace() were something like replaceAll() or matches(). The comment would explain what regex is supposed to describe. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]