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. Whether to use punctuation in comments or not?

Whether to use punctuation in comments or not?

Scheduled Pinned Locked Moved The Lounge
question
32 Posts 18 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.
  • S Offline
    S Offline
    sacoskun
    wrote on last edited by
    #1

    I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

    P L G S B 10 Replies Last reply
    0
    • S sacoskun

      I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

      P Offline
      P Offline
      Paul Watson
      wrote on last edited by
      #2

      // Yes.

      regards, Paul Watson Ireland & South Africa

      Shog9 wrote:

      And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

      D 1 Reply Last reply
      0
      • S sacoskun

        I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

        L Offline
        L Offline
        Luis Alonso Ramos
        wrote on last edited by
        #3

        I don't think there is a standard. What I do is that I put a period after long comments (full sentences), while short comments don't end with a period: // Open the file, process it and if something bad happens, throw an // exception that will be caught by the calling code. // Just close the file It works for me :)

        Luis Alonso Ramos Intelectix Chihuahua, Mexico

        My Blog!

        1 Reply Last reply
        0
        • S sacoskun

          I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #4

          //
          // In general, I make block comments that are 'narrative' use full
          // sentences and/or paragraphs. That means they get full punctuation,
          // including the terminating period.
          //

          // one line descriptive comments aren't sentences


          Software Zen: delete this;

          1 Reply Last reply
          0
          • S sacoskun

            I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5

            Yes. Also, spelling counts.

            ----

            I don't care what you consider witty, but at least I do not blather on posting nonsense like Jim Crafton.

            -- Stringcheese, humbled by Crafton's ability to string together multiple sentences

            P 1 Reply Last reply
            0
            • S Shog9 0

              Yes. Also, spelling counts.

              ----

              I don't care what you consider witty, but at least I do not blather on posting nonsense like Jim Crafton.

              -- Stringcheese, humbled by Crafton's ability to string together multiple sentences

              P Offline
              P Offline
              Paul Watson
              wrote on last edited by
              #6

              And if you can work some ASCII art in, all the better.

              /* /\
              //\\
              //\\
              //\\
              ||
              || */

              regards, Paul Watson Ireland & South Africa

              Shog9 wrote:

              And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

              S M 2 Replies Last reply
              0
              • P Paul Watson

                And if you can work some ASCII art in, all the better.

                /* /\
                //\\
                //\\
                //\\
                ||
                || */

                regards, Paul Watson Ireland & South Africa

                Shog9 wrote:

                And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                S Offline
                S Offline
                Shog9 0
                wrote on last edited by
                #7

                Absolutely! :) Actually, there's a tool around here somewhere for doing ASCII flowcharts in comments; i've used that before for sketching out class hierarchies at the top of source files.

                You must be careful in the forest Broken glass and rusty nails If you're to bring back something for us I have bullets for sale...

                P 1 Reply Last reply
                0
                • S Shog9 0

                  Absolutely! :) Actually, there's a tool around here somewhere for doing ASCII flowcharts in comments; i've used that before for sketching out class hierarchies at the top of source files.

                  You must be careful in the forest Broken glass and rusty nails If you're to bring back something for us I have bullets for sale...

                  P Offline
                  P Offline
                  Paul Watson
                  wrote on last edited by
                  #8

                  Ah! So that is what that comment was in my colleague's code. I thought he was trying to draw a frame from The Simpsons.

                  regards, Paul Watson Ireland & South Africa

                  Shog9 wrote:

                  And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                  S 1 Reply Last reply
                  0
                  • S sacoskun

                    I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

                    B Offline
                    B Offline
                    Brady Kelly
                    wrote on last edited by
                    #9

                    Where my comments are plain English, I use standard English punctuation. Where the comments are technical metadat, I don't. E.g. of case #2 using (SomeObject) { }// using SomeObject

                    1 Reply Last reply
                    0
                    • P Paul Watson

                      Ah! So that is what that comment was in my colleague's code. I thought he was trying to draw a frame from The Simpsons.

                      regards, Paul Watson Ireland & South Africa

                      Shog9 wrote:

                      And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                      S Offline
                      S Offline
                      Shog9 0
                      wrote on last edited by
                      #10

                      Heh. I've also used ASCII logos, and that ASCII-art version of the cover from Fear and Loathing in Las Vegas... Whatever best describes the code, ya know? ;)

                      ----

                      I don't care what you consider witty, but at least I do not blather on posting nonsense like Jim Crafton.

                      -- Stringcheese, humbled by Crafton's ability to string together multiple sentences

                      1 Reply Last reply
                      0
                      • P Paul Watson

                        // Yes.

                        regards, Paul Watson Ireland & South Africa

                        Shog9 wrote:

                        And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                        D Offline
                        D Offline
                        David Wulff
                        wrote on last edited by
                        #11

                        // No But then you knew I was going to say that, eh? ;P

                        // Seriously though, I don't put periods at the end of my comments, but I will
                        // .. for a sentence break in the middle of one. Why? I really have no idea,
                        // .. it has always been that way

                        Then again, I am one of those weird people who still uses two spaces after a period for readability.


                        Ðavid Wulff What kind of music should programmers listen to?
                        Join the Code Project Last.fm group | dwulff
                        I'm so gangsta I eat cereal without the milk

                        P _ V 3 Replies Last reply
                        0
                        • P Paul Watson

                          And if you can work some ASCII art in, all the better.

                          /* /\
                          //\\
                          //\\
                          //\\
                          ||
                          || */

                          regards, Paul Watson Ireland & South Africa

                          Shog9 wrote:

                          And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                          M Offline
                          M Offline
                          Member 96
                          wrote on last edited by
                          #12

                          Cool! I actually *do* have ascii art in all my projects source code comments at some point or another. I figure it will amuse someone some day down the road since no one else ever looks at the great majority of my code anyway. It serves a useful purpose in denoting blocks of commonly related code such as separating the Microsoft auto generated form code in c# winform projects from my own code:

                          // __ _ _ ___ ____ __ __ __ __ __ ___ ___
                          // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
                          //( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
                          // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)


                          "I don't want more choice. I just want better things!" - Edina Monsoon

                          S 1 Reply Last reply
                          0
                          • S sacoskun

                            I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

                            J Offline
                            J Offline
                            Josh Smith
                            wrote on last edited by
                            #13

                            If you program in, say, C# do you sometimes put a semi-colon at the end of a statement and sometimes not? No, because the compiler rejects the code as being incorrect. In my opinion, the same standard for quality and accuracy should be applied to comments as well. Why write beautiful code and then decorate it with ignorant boogers?

                            :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                            H S 2 Replies Last reply
                            0
                            • D David Wulff

                              // No But then you knew I was going to say that, eh? ;P

                              // Seriously though, I don't put periods at the end of my comments, but I will
                              // .. for a sentence break in the middle of one. Why? I really have no idea,
                              // .. it has always been that way

                              Then again, I am one of those weird people who still uses two spaces after a period for readability.


                              Ðavid Wulff What kind of music should programmers listen to?
                              Join the Code Project Last.fm group | dwulff
                              I'm so gangsta I eat cereal without the milk

                              P Offline
                              P Offline
                              Paul Watson
                              wrote on last edited by
                              #14

                              Good idea actually though I tend to just indent paragraphs. So far I've written half my life story into my code...

                              regards, Paul Watson Ireland & South Africa

                              Shog9 wrote:

                              And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                              K S 2 Replies Last reply
                              0
                              • P Paul Watson

                                Good idea actually though I tend to just indent paragraphs. So far I've written half my life story into my code...

                                regards, Paul Watson Ireland & South Africa

                                Shog9 wrote:

                                And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                                K Offline
                                K Offline
                                keyboard warrior
                                wrote on last edited by
                                #15

                                Paul Watson wrote:

                                So far I've written half my life story into my code...

                                awesome

                                ----------------------------------------------------------- Completion Deadline: two days before the day after tomorrow

                                1 Reply Last reply
                                0
                                • S sacoskun

                                  I would be thankful if someone tell me the answer. What is the standard usage? In the easiest, I mean I would like to know whether to put . at the end of my comment or not:)

                                  M Offline
                                  M Offline
                                  Marc Clifton
                                  wrote on last edited by
                                  #16

                                  If it's a sentence, write it like a sentence. If it's fragment, don't end it with a period. Marc

                                  Thyme In The Country
                                  Interacx
                                  My Blog

                                  1 Reply Last reply
                                  0
                                  • P Paul Watson

                                    Good idea actually though I tend to just indent paragraphs. So far I've written half my life story into my code...

                                    regards, Paul Watson Ireland & South Africa

                                    Shog9 wrote:

                                    And with that, Paul closed his browser, sipped his herbal tea, fixed the flower in his hair, and smiled brightly at the multitude of cute, furry animals flocking around the grassy hillside where he sat coding Ruby on his Mac...

                                    S Offline
                                    S Offline
                                    Shog9 0
                                    wrote on last edited by
                                    #17

                                    Paul Watson wrote:

                                    So far I've written half my life story into my code...

                                    Half my life story is my code... :~

                                    You must be careful in the forest Broken glass and rusty nails If you're to bring back something for us I have bullets for sale...

                                    C 1 Reply Last reply
                                    0
                                    • J Josh Smith

                                      If you program in, say, C# do you sometimes put a semi-colon at the end of a statement and sometimes not? No, because the compiler rejects the code as being incorrect. In my opinion, the same standard for quality and accuracy should be applied to comments as well. Why write beautiful code and then decorate it with ignorant boogers?

                                      :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                                      H Offline
                                      H Offline
                                      hlmechanic
                                      wrote on last edited by
                                      #18

                                      Josh Smith wrote:

                                      Why write beautiful code and then decorate it with ignorant boogers?

                                      Variety is the spice of life? :-D

                                      J 1 Reply Last reply
                                      0
                                      • H hlmechanic

                                        Josh Smith wrote:

                                        Why write beautiful code and then decorate it with ignorant boogers?

                                        Variety is the spice of life? :-D

                                        J Offline
                                        J Offline
                                        Josh Smith
                                        wrote on last edited by
                                        #19

                                        hlmechanic wrote:

                                        Variety is the spice of life?

                                        In that case, I think I'll write all my comments in a mixture of ebonics and textspeak...

                                        // yo bi4tch! dis cod3 be 4xin d4 us3r if d4 foo w4nn4 s4v3 dis shiznit?

                                        :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                                        1 Reply Last reply
                                        0
                                        • M Member 96

                                          Cool! I actually *do* have ascii art in all my projects source code comments at some point or another. I figure it will amuse someone some day down the road since no one else ever looks at the great majority of my code anyway. It serves a useful purpose in denoting blocks of commonly related code such as separating the Microsoft auto generated form code in c# winform projects from my own code:

                                          // __ _ _ ___ ____ __ __ __ __ __ ___ ___
                                          // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
                                          //( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
                                          // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)


                                          "I don't want more choice. I just want better things!" - Edina Monsoon

                                          S Offline
                                          S Offline
                                          sacoskun
                                          wrote on last edited by
                                          #20

                                          Cool I luv the idea;). Do you know any simple program that creates me bigger texts(e.g. 3 lines by height) in ascii?

                                          M 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