wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Coding Convention - comments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Coding Convention - comments" Watch "Coding Convention - comments" New topic
Author

Coding Convention - comments

Anna Hays
Ranch Hand

Joined: Nov 09, 2003
Posts: 131
Hi,

I read the coding conventions on the Sun website - http://java.sun.com/docs/codeconv/html/CodeConventions.doc10.html#182, I got the impression that each instance variable has to be commented and it is commented in the /* */ and /** */ style. I found this is very unreadable and uneccessary if the variable is self descriptive. Can someone tell me if the following comment style is acceptable please??


Thanks!
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
Anna, you do not need comment each instance variable. Naming a variable self descriptive is more helpful. But you may need to do commenting with /** */ for documentation purpose wherever required.
Anna Hays
Ranch Hand

Joined: Nov 09, 2003
Posts: 131
Thanks.

What about private variables? // or /* */? /* */ looks consistent with /** */, but // looks neater.

Do you think this acceptable?

Or the style in my previous post?

Thank you!!
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
Originally posted by Anna Kafei:
Thanks.

What about private variables? // or /* */? /* */ looks consistent with /** */, but // looks neater.

Do you think this acceptable?

Or the style in my previous post?

Thank you!!


If you want documentation for private variables then use /** */ type of comments.

Otherwise it depends on your judgement. For ex:
int int1 = 0; // integer 1

by seeing above line we know it is integer value, so I feel // integer 1 kind of comments not required.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Coding Convention - comments