Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Why no emphasis on commenting

  1. #1
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,444 Times in 2,395 Posts

    Default Why no emphasis on commenting

    Most of the code I see posted by students contains no comments. When asked about it, some say they only do it before turning in the assignment and I suppose that is only if the instructor requires it.
    I have often helped a student with code that if the student had a design for what a section of code was supposed to do and wrote comments describing what it was to do, then when he wrote the code he could look at his design and keep the code on track.

    I guess most students don't design their code, they just keep typing and changing it until it works. The shotgun approach. Keep shooting until you hit something.

    There I got that off my chest.


    PS When I was a TA at school 50% of the grade was for a working program, the other 50% was for design and comments. A none working program could get the same score as one that gave the desired output.

  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Thanked 619 Times in 561 Posts
    Blog Entries

    Default Re: Why no emphasis on commenting

    For me it depends on the size and scope of the project. I had assignments which required only a simple script and and to be honest, the only comments were those with my name, the class name, and the assignment number.

    Quantity of comments does not equal quality of code readability. I hated classes where the rule of thumb was to comment every line of code. Writing effective comments (something short and concise which explains a ~5-10 lines of code, depending on difficulty of reading just the code) is something I think a lot of classes really skimp out on.

    I believe that encouraging students to comment is better than not, but if it's something that they see as a "burden" while coding rather than being helpful, they won't do it later on in their careers.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    United Kingdom
    My Mood
    Thanked 293 Times in 226 Posts
    Blog Entries

    Default Re: Why no emphasis on commenting

    I guess it all depends what kind of person you are to begin with.

    I personally am quite organized. I've always liked to design things first and I've always left myself comments whether it be whilst programming or writing HTML/PHP code etc.

    It's good to be able to read what is going on without having to analyse the code and my comments have proven to be invaluable when going back over older projects.
    Comments are also useful for anyone else who happens to be working on the code with you or reads your code at a later date.

    When you first start programming, I believe it is very handy to get into the habit of commenting your code. It's all part of the learning process.
    If you can comment your code successfully then it proves that you understand what is happening regardless of if it is required or not.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. Mastermind commenting help needed! :)
    By Mahela in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 28th, 2011, 03:55 PM