Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Number of code comments is directly proportional to "X" ?

Number of code comments is directly proportional to "X" ?

Scheduled Pinned Locked Moved The Lounge
questionlearning
30 Posts 22 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rama Krishna Vavilala

    What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

    R Offline
    R Offline
    realJSOP
    wrote on last edited by
    #2

    The only time I notice comments in an app is when there aren't enough of them. I never really considered any other aspect of it. :)

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

    1 Reply Last reply
    0
    • R Rama Krishna Vavilala

      What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

      C Offline
      C Offline
      Christian Bruggemann
      wrote on last edited by
      #3

      I do not think this has anything to do with age. This is rather a question of discipline. I've seen "old" programmers who do not write comments at all as well as some which write a lot of comments. The same goes for young programmers. I think this has also something to do with skill, because programmers who comment a lot (and do this the right way) know how important it will be for future development.

      L 1 Reply Last reply
      0
      • R Rama Krishna Vavilala

        What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

        N Offline
        N Offline
        Nagy Vilmos
        wrote on last edited by
        #4

        X == experience An old newbie will add less comments than a youngster with some experience. As an old fart 20+ year code monk, I comment BEFORE I code.


        Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

        R J 2 Replies Last reply
        0
        • N Nagy Vilmos

          X == experience An old newbie will add less comments than a youngster with some experience. As an old fart 20+ year code monk, I comment BEFORE I code.


          Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

          R Offline
          R Offline
          RugbyLeague
          wrote on last edited by
          #5

          code monk?

          P N 2 Replies Last reply
          0
          • R Rama Krishna Vavilala

            What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

            R Offline
            R Offline
            RJOberg
            wrote on last edited by
            #6

            I don't think the number is directly proportional to any one thing. It is more the experience of the programmer in conjunction with the complexity of the program. First place I worked I was told 'All code should be self documenting' and I should only put comments in when I could not simplify the code so that anyone reading it could figure out what it meant. Now I always added more comments than that. All but the simplest procedures had the usual "This procedures takes an int, string, etc then what it does, and what the output is expected to be, along with any exceptions I knew it could throw."

            1 Reply Last reply
            0
            • R RugbyLeague

              code monk?

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #7

              That's a code monkey with a Pauline Tonsure.

              Forgive your enemies - it messes with their heads

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

              1 Reply Last reply
              0
              • R RugbyLeague

                code monk?

                N Offline
                N Offline
                Nagy Vilmos
                wrote on last edited by
                #8

                You know those little fellas in the high mountains. We see the beauty in the alignment of electrons and that creates the program. Right now I am twelve feet away from computer just thinking #clicks 'Post Message'#


                Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                1 Reply Last reply
                0
                • R Rama Krishna Vavilala

                  What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  Neither age nor exprience. I have met plenty of coders that have been in the field for almost as long as I have been alive. These gents are set in their ways. Its like teaching an old dog new tricks (although I really dont see writting appropriate comments as a 'new' trick... you get the point though). Its more likely a personality thing. This also goes along with what type of comments are left. I have seen some code left by all varieties of programmers that is simply "TODO: Fix this" or "TODO: Not sure what this is about. Probably refactor" etc. Not so usefull. In fact leaves the inheritor with serious doubts about the system. Again, its personality. Are you the type of person that puts "Hi" in the subject line of your emails? Or maybe you don't even put anything in the subject.

                  Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

                  1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    Actually I must be getting younger then. I more and more assume that the other programmers are true masters of the obvious and try to comment only what is not so obvious. Documentation comments for classes and methods of course are another case.

                    And from the clouds a mighty voice spoke:
                    "Smile and be happy, for it could come worse!"

                    And I smiled and was happy
                    And it came worse.

                    L 1 Reply Last reply
                    0
                    • R Rama Krishna Vavilala

                      What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #11

                      X = Bra size.

                      1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                        B Offline
                        B Offline
                        BobJanova
                        wrote on last edited by
                        #12

                        It's mostly a matter of style, once you've been taught enough that you stop writing stream of consciousness spaghetti with no comments. Some people like lots of comments, some people like few comments and readable code. I doubt that changes much with age, and I would actually expect commenting to reduce with experience, due to (i) getting jaded and not making such an effort and (ii) seeing more things as obvious and not worth commenting. Apart from required comments (method and class headers etc) which I put in under duress, a lot of my code doesn't have comments, because it's obvious. I comment any subtle or clever parts (which is 5% at most of any real system) and wherever there is a non-obvious reason for something to be like it is, but most code, when well written, is self-describing.

                        1 Reply Last reply
                        0
                        • R Rama Krishna Vavilala

                          What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                          Sander RosselS Offline
                          Sander RosselS Offline
                          Sander Rossel
                          wrote on last edited by
                          #13

                          X = Unreadability of the code itself. Good code needs no comments. Some exceptions.

                          It's an OO world.

                          public class Naerling : Lazy<Person>{}

                          1 Reply Last reply
                          0
                          • R Rama Krishna Vavilala

                            What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                            S Offline
                            S Offline
                            Soulus83
                            wrote on last edited by
                            #14

                            Sorry, my code autodocuments itself. When I'm in the need to add a comment to code, I refactor that part of the logic. :-D

                            "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

                            J 1 Reply Last reply
                            0
                            • S Soulus83

                              Sorry, my code autodocuments itself. When I'm in the need to add a comment to code, I refactor that part of the logic. :-D

                              "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

                              J Offline
                              J Offline
                              James H
                              wrote on last edited by
                              #15

                              I tend to agree - the more iffy the code I am writing the more comments it has - in general I like the code to explain for itself and I always look at what other peoples code is doing despite any comments they have left because the code doesn't lie - comments are often outdated or just an indication of what the programmer hoped was happening. When I know my code is not doing something obvious I comment it - but I much prefer it to be obvious

                              1 Reply Last reply
                              0
                              • R Rama Krishna Vavilala

                                What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                                I Offline
                                I Offline
                                ii_noname_ii
                                wrote on last edited by
                                #16

                                Dim NumCodeComments as integer 'Number of comments numComments=getRandomNumber() 'getRandomNumber is a general function that returns a random integer. The file can be found... That's my opinion. Look at these comments. Are they: a- necessary ? b- a waste of space & time? c- a bonus? b is my answer. Keep the var names clear, the sub names clear. Sort the code in regions. And most comments become useless, and decrease the readability. If the comment is necessary for someone to understand what's going on, then you're doing something wrong, not following best practises. --> AND THEREFORE, numComments is NOT proportional to skillLevel 'var skillLevel is defined in class... lol I usually remove comments that serve no puropose. Some pseudo code may come in comments sometime precodings, but when it's done, delete the comments.

                                G 1 Reply Last reply
                                0
                                • R Rama Krishna Vavilala

                                  What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                                  P Offline
                                  P Offline
                                  pt1401
                                  wrote on last edited by
                                  #17

                                  foreach (project I've written) {   if ((I wrote this code a while ago) && (I don't understand it any more))     x++; }

                                  1 Reply Last reply
                                  0
                                  • L Lost User

                                    Actually I must be getting younger then. I more and more assume that the other programmers are true masters of the obvious and try to comment only what is not so obvious. Documentation comments for classes and methods of course are another case.

                                    And from the clouds a mighty voice spoke:
                                    "Smile and be happy, for it could come worse!"

                                    And I smiled and was happy
                                    And it came worse.

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #18

                                    CDP1802 wrote:

                                    Documentation comments for classes and methods of course are another case.

                                    Ahaa... By suggesting classes and methods should be commented you are confirming the feeling I've had for for years that these constructs are not easy to understand and probably just an 'invention of the devil' to make it harder for us developers to do anything productive in a reasonable amount of time.

                                    Graybeard - back again!

                                    L 1 Reply Last reply
                                    0
                                    • L Lost User

                                      CDP1802 wrote:

                                      Documentation comments for classes and methods of course are another case.

                                      Ahaa... By suggesting classes and methods should be commented you are confirming the feeling I've had for for years that these constructs are not easy to understand and probably just an 'invention of the devil' to make it harder for us developers to do anything productive in a reasonable amount of time.

                                      Graybeard - back again!

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #19

                                      That's long ago and hard to remember. It must have been the time when I retired my 8 bit Atari and replaced it with a shiny new Atari ST and a C compiler. I really can't remember what it was like to write endless spaghetti Atari BASIC programs :)

                                      And from the clouds a mighty voice spoke:
                                      "Smile and be happy, for it could come worse!"

                                      And I smiled and was happy
                                      And it came worse.

                                      1 Reply Last reply
                                      0
                                      • N Nagy Vilmos

                                        X == experience An old newbie will add less comments than a youngster with some experience. As an old fart 20+ year code monk, I comment BEFORE I code.


                                        Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                                        J Offline
                                        J Offline
                                        JSRustad
                                        wrote on last edited by
                                        #20

                                        I've seen code written by someone with 30 years experience that had almost no comments (and the ones it did have, were wrong because they had not been updated when the code changed). Better yet, this was C code that made use of every trick possible in order to fit in a small embedded system. I've also seen code written by younger people with less experience that has good comments. It's not age or experience. Maybe it's pain experienced by having to support code of the first type?

                                        1 Reply Last reply
                                        0
                                        • R Rama Krishna Vavilala

                                          What is X? I think the X would be programmer's age. I have seen the ratio of comments to actual code to be as high as 4:1. Of course, for younger programmer the ratio turns out to be 0. As usual there are some exceptions. Have you found this to be true in your experience?

                                          B Offline
                                          B Offline
                                          bkebamc
                                          wrote on last edited by
                                          #21

                                          It's all very context-dependent: x = (english literacy)* (philosophical bent)* (domain understanding)* (management emphasis) / (API knowledge) / {coding literacy) / (mastery of graphical methods) / (deadline pressure) Plenty of room there for self-justification...

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups