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. Other Discussions
  3. The Weird and The Wonderful
  4. I frequently type un-compilable code or comments to myself...

I frequently type un-compilable code or comments to myself...

Scheduled Pinned Locked Moved The Weird and The Wonderful
discussion
13 Posts 8 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.
  • P puromtec1

    ...to remind myself of my thoughts when I quit last time, but this comment takes the cake: ; DO SOMETHING, I DON'T KNOW WHAT, BUT DO IT HERE..

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

    I was recently told that REM stood for REMark and did the same as ' in VB or // in C#... I was very tempted to put something like REM - Losing My Religion above every Class I made :laugh:

    It's an OO world.

    1 Reply Last reply
    0
    • P puromtec1

      ...to remind myself of my thoughts when I quit last time, but this comment takes the cake: ; DO SOMETHING, I DON'T KNOW WHAT, BUT DO IT HERE..

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

      Few interesting comments : int i=10; //Don't forget //DO NOT REMOVE THIS COMMENT. REMOVING IT WILL AFFECT THE BUILD PROCESS

      - Bits and Bytes Rules! 10(jk)

      Sander RosselS 1 Reply Last reply
      0
      • L Lost User

        Few interesting comments : int i=10; //Don't forget //DO NOT REMOVE THIS COMMENT. REMOVING IT WILL AFFECT THE BUILD PROCESS

        - Bits and Bytes Rules! 10(jk)

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

        I hate comments that are there just because 'code should be commented'... I see stuff like

        ' This sub gets info from the database.
        Public Sub GetInfoFromDataBase(connString As String)
        'blah blah blah...

        ' Open the connection.
        conn.Open

        ' Check if the value is not DBNull or Nothing.
        If dataRow("someColumn").Value IsNot DBNull.Value AndAlso dataRow("someColumn").Value IsNot Nothing Then
        ' Do stuff...
        End If

        'etc.
        End Sub

        And then when there really is a whole lot of unreadable code no one commented it... :~

        It's an OO world.

        B S B 3 Replies Last reply
        0
        • Sander RosselS Sander Rossel

          I hate comments that are there just because 'code should be commented'... I see stuff like

          ' This sub gets info from the database.
          Public Sub GetInfoFromDataBase(connString As String)
          'blah blah blah...

          ' Open the connection.
          conn.Open

          ' Check if the value is not DBNull or Nothing.
          If dataRow("someColumn").Value IsNot DBNull.Value AndAlso dataRow("someColumn").Value IsNot Nothing Then
          ' Do stuff...
          End If

          'etc.
          End Sub

          And then when there really is a whole lot of unreadable code no one commented it... :~

          It's an OO world.

          B Offline
          B Offline
          BillW33
          wrote on last edited by
          #5

          Agreed. I really hate it when, in C#, someone just puts the method name where there is supposed to be a summary of what the method does.

          /// <summary>
          /// Method Name
          /// </summary>
          public void MethodName()
          {
          //uncommented code here...
          }

          Just because the code works, it doesn't mean that it is good code.

          P 1 Reply Last reply
          0
          • B BillW33

            Agreed. I really hate it when, in C#, someone just puts the method name where there is supposed to be a summary of what the method does.

            /// <summary>
            /// Method Name
            /// </summary>
            public void MethodName()
            {
            //uncommented code here...
            }

            Just because the code works, it doesn't mean that it is good code.

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

            C# guidelines. Method names should be descriptive. Why would you need comments?

            I'm not a stalker, I just know things. Oh by the way, you're out of milk.

            Forgive your enemies - it messes with their heads

            My blog | My articles | MoXAML PowerToys | Onyx

            P J B 3 Replies Last reply
            0
            • P Pete OHanlon

              C# guidelines. Method names should be descriptive. Why would you need comments?

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              P Offline
              P Offline
              puromtec1
              wrote on last edited by
              #7

              If you have a nice tool like EA, you can put the comments at the top of methods and have those propagate into an API document. Who doesn't like a good API doc?

              1 Reply Last reply
              0
              • P Pete OHanlon

                C# guidelines. Method names should be descriptive. Why would you need comments?

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                J Offline
                J Offline
                Jorgen Andersson
                wrote on last edited by
                #8

                It took me a bit longer than I'd like to admit to detect the sarchasm.

                List of common misconceptions

                P 1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  I hate comments that are there just because 'code should be commented'... I see stuff like

                  ' This sub gets info from the database.
                  Public Sub GetInfoFromDataBase(connString As String)
                  'blah blah blah...

                  ' Open the connection.
                  conn.Open

                  ' Check if the value is not DBNull or Nothing.
                  If dataRow("someColumn").Value IsNot DBNull.Value AndAlso dataRow("someColumn").Value IsNot Nothing Then
                  ' Do stuff...
                  End If

                  'etc.
                  End Sub

                  And then when there really is a whole lot of unreadable code no one commented it... :~

                  It's an OO world.

                  S Offline
                  S Offline
                  StM0n
                  wrote on last edited by
                  #9

                  Ah... Captain Obvious... finally we meet...

                  (yes|no|maybe)*

                  1 Reply Last reply
                  0
                  • J Jorgen Andersson

                    It took me a bit longer than I'd like to admit to detect the sarchasm.

                    List of common misconceptions

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

                    But in the end, you did detect it.

                    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    J 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      But in the end, you did detect it.

                      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      J Offline
                      J Offline
                      Jorgen Andersson
                      wrote on last edited by
                      #11

                      I am but a naive human being, and it's going to be my downfall.

                      List of common misconceptions

                      1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        I hate comments that are there just because 'code should be commented'... I see stuff like

                        ' This sub gets info from the database.
                        Public Sub GetInfoFromDataBase(connString As String)
                        'blah blah blah...

                        ' Open the connection.
                        conn.Open

                        ' Check if the value is not DBNull or Nothing.
                        If dataRow("someColumn").Value IsNot DBNull.Value AndAlso dataRow("someColumn").Value IsNot Nothing Then
                        ' Do stuff...
                        End If

                        'etc.
                        End Sub

                        And then when there really is a whole lot of unreadable code no one commented it... :~

                        It's an OO world.

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

                        That (well, the first part) is what you get with coding standards that mandate comments (and function headers, referring to the subthread above). Comments should be there to explain something non-trivial (i.e. that a two second glance at the code won't give you), imo – a summary of a multi-line complex piece of logic, or an explanation as to why you want to do what the code is doing.

                        1 Reply Last reply
                        0
                        • P Pete OHanlon

                          C# guidelines. Method names should be descriptive. Why would you need comments?

                          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                          Forgive your enemies - it messes with their heads

                          My blog | My articles | MoXAML PowerToys | Onyx

                          B Offline
                          B Offline
                          BillW33
                          wrote on last edited by
                          #13

                          Yes, the method names should be descriptive. In my experience the ones who don't use descriptive method names also don't bother to write good comments. Also, sometimes, even a good method name can use a little extra description now and then. ;) :)

                          Just because the code works, it doesn't mean that it is good code.

                          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