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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. With comments like this, no wonder commenting gets a bad reputation

With comments like this, no wonder commenting gets a bad reputation

Scheduled Pinned Locked Moved The Lounge
question
30 Posts 16 Posters 1 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.
  • B Offline
    B Offline
    B Clay Shannon
    wrote on last edited by
    #1

    I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

    J Mike HankeyM L P J 15 Replies Last reply
    0
    • B B Clay Shannon

      I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

      J Offline
      J Offline
      jeron1
      wrote on last edited by
      #2

      What I really love is when code gets changed but the comment does not. There was a huge thread on these types of things not that long ago. //Check Connection breakConnection();

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst

      1 Reply Last reply
      0
      • B B Clay Shannon

        I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

        Mike HankeyM Online
        Mike HankeyM Online
        Mike Hankey
        wrote on last edited by
        #3

        Does seem excessively redundant! :) I think even Gomer would know not to do this.

        Have you ever just looked at someone and knew the wheel was turning but the hamster was dead? Trying to understand the behavior of some people is like trying to smell the color 9.

        J P R 3 Replies Last reply
        0
        • Mike HankeyM Mike Hankey

          Does seem excessively redundant! :) I think even Gomer would know not to do this.

          Have you ever just looked at someone and knew the wheel was turning but the hamster was dead? Trying to understand the behavior of some people is like trying to smell the color 9.

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #4

          Mike Hankey wrote:

          I think even Gomer would know not to do this.

          He'd run around screaming "citizens arrayest! citizens arrayest!"

          "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst

          1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            Does seem excessively redundant! :) I think even Gomer would know not to do this.

            Have you ever just looked at someone and knew the wheel was turning but the hamster was dead? Trying to understand the behavior of some people is like trying to smell the color 9.

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

            Mike Hankey wrote:

            even Gomer would know not to do this.

            As I recall, he's an automotive mechanic, you don't think his wrenches are marked with their sizes? Seems redundant to me. :rolleyes:

            Mike HankeyM 1 Reply Last reply
            0
            • B B Clay Shannon

              I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

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

              That's worth more points if it turns out that checkConnection actually does not check connection.

              B 1 Reply Last reply
              0
              • P PIEBALDconsult

                Mike Hankey wrote:

                even Gomer would know not to do this.

                As I recall, he's an automotive mechanic, you don't think his wrenches are marked with their sizes? Seems redundant to me. :rolleyes:

                Mike HankeyM Online
                Mike HankeyM Online
                Mike Hankey
                wrote on last edited by
                #7

                A good mechanic can tell the size of a wrench by looking at it so yeah that would be redundant to mark them.

                Have you ever just looked at someone and knew the wheel was turning but the hamster was dead? Trying to understand the behavior of some people is like trying to smell the color 9.

                1 Reply Last reply
                0
                • L Lost User

                  That's worth more points if it turns out that checkConnection actually does not check connection.

                  B Offline
                  B Offline
                  B Clay Shannon
                  wrote on last edited by
                  #8

                  It tries to open a connection; the catch block displays an err msg if it fails.

                  I L 2 Replies Last reply
                  0
                  • B B Clay Shannon

                    It tries to open a connection; the catch block displays an err msg if it fails.

                    I Offline
                    I Offline
                    Ian Shlasko
                    wrote on last edited by
                    #9

                    Well then it's named wrong... It should have been:

                    // Check Connection
                    tryToOpenConnectionAndDisplayAnErrorMessageIfItFailsThankYouAndGoodnight();

                    Proud to have finally moved to the A-Ark. Which one are you in?
                    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                    1 Reply Last reply
                    0
                    • B B Clay Shannon

                      I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

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

                      // Check connection checkConnection(); // Cash connection checkConnection(); // Credit Card connection checkConnection(); // Debit Card connection checkConnection(); :-D

                      Richard DeemingR 1 Reply Last reply
                      0
                      • B B Clay Shannon

                        It tries to open a connection; the catch block displays an err msg if it fails.

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

                        B. Clay Shannon wrote:

                        It tries to open a connection

                        That was my first hunch. :((

                        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                        1 Reply Last reply
                        0
                        • P PIEBALDconsult

                          // Check connection checkConnection(); // Cash connection checkConnection(); // Credit Card connection checkConnection(); // Debit Card connection checkConnection(); :-D

                          Richard DeemingR Offline
                          Richard DeemingR Offline
                          Richard Deeming
                          wrote on last edited by
                          #12

                          PIEBALDconsult wrote:

                          // Cheque connection chequeConnection();

                          FTFY. ;P


                          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                          P 1 Reply Last reply
                          0
                          • Richard DeemingR Richard Deeming

                            PIEBALDconsult wrote:

                            // Cheque connection chequeConnection();

                            FTFY. ;P


                            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

                            czechConnection frenchConnection

                            1 Reply Last reply
                            0
                            • B B Clay Shannon

                              I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

                              J Offline
                              J Offline
                              Jeremy Falcon
                              wrote on last edited by
                              #14

                              It gets even better. I've even seen something akin to this in Basic...

                              ' assign 5 to x
                              Let x = 5

                              Jeremy Falcon

                              L Sander RosselS 2 Replies Last reply
                              0
                              • B B Clay Shannon

                                I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

                                N Offline
                                N Offline
                                Nemanja Trifunovic
                                wrote on last edited by
                                #15

                                Ughhh. It should really be: // Check connection check_connection();

                                utf8-cpp

                                1 Reply Last reply
                                0
                                • B B Clay Shannon

                                  I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

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

                                  Just because he's a pro at naming a function doesn't mean the comment is bad.

                                  1 Reply Last reply
                                  0
                                  • J Jeremy Falcon

                                    It gets even better. I've even seen something akin to this in Basic...

                                    ' assign 5 to x
                                    Let x = 5

                                    Jeremy Falcon

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

                                    Or:

                                    // assign 0.1 to x
                                    double x = 0.1;

                                    Which is actually a lie.

                                    1 Reply Last reply
                                    0
                                    • B B Clay Shannon

                                      I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

                                      S Offline
                                      S Offline
                                      Slacker007
                                      wrote on last edited by
                                      #18

                                      I don't always comment my code, but when I do... //TODO: insert comment here.

                                      1 Reply Last reply
                                      0
                                      • B B Clay Shannon

                                        I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

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

                                        // Whereas we wish for this application to interact with a database // and whereas such interaction will require a connection to the server and instance of said database // and whereas a connection of this type relies on many fluctuating unknowns within the server and network infrastructure // and further, given the business-critical nature of this application and its associated interaction with the database // it has therefore been determined that checking whether or not such a connection can be successfully negotiated as early as possible // in the event that such a connection cannot be negotiated, then remediatory actions may be activated in a more timely manner than otherwise feasible checkConnection();

                                        1 Reply Last reply
                                        0
                                        • B B Clay Shannon

                                          I ran across this in some legacy code, and I hereby submit it to "the most redundant/superfluous code comment contest": // Check connection checkConnection(); Why do I hear, in my mind's ear, Jim Nabors as Gomer Pyle drawling "Surprise, surprise!" when I see this comment?

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

                                          Found stuff like that too.

                                          ' Save the customer.
                                          SaveCustomer()

                                          Even worse:

                                          ' Save the customer.
                                          SaveProduct()

                                          The code was copy/pasted and then changed, but of course the comments were overlooked. But that's not all:

                                          ' A helper variable
                                          Dim helper As String
                                          helper = "Something"
                                          ' Lots of code here...
                                          If someCondition Then
                                          MessageBox.Show(helper)
                                          End If

                                          Yes, in that last part the 'helper variable' is actually a constant string that may or may not be used further in the function... Good thing it was commented :doh: And you wonder why VB has a bad name? This has nothing to do with VB, but with coders that can't code...

                                          It's an OO world.

                                          public class SanderRossel : Lazy<Person>
                                          {
                                          public void DoWork()
                                          {
                                          throw new NotSupportedException();
                                          }
                                          }

                                          P 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