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. What was he thinking?

What was he thinking?

Scheduled Pinned Locked Moved The Lounge
question
18 Posts 13 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.
  • L Lost User

    Given the way some people use braces it may have been necessary. :laugh:

    J Offline
    J Offline
    jim lahey
    wrote on last edited by
    #5

    Our apprentices code like that. I get ones like this checked in regularly:

    //parses the datetime
    var dateTime = DateTime.Parse(txtDate.Text);

    I used to comment most lines many years ago, before I became familiar with what I was doing. Then I realised it's a lot quicker and a lot less effort to simply read your code.

    A 1 Reply Last reply
    0
    • F Florin Jurcovici

      I mean, the programmer leaving this line in code:

      }//-- code block ends here
      

      I suppose lightning up a dull Monday?

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #6

      I don't know. There are some times where this would be extremely helpful. Usually about 4:50 PM on a Friday.

      K 1 Reply Last reply
      0
      • F Florin Jurcovici

        I mean, the programmer leaving this line in code:

        }//-- code block ends here
        

        I suppose lightning up a dull Monday?

        W Offline
        W Offline
        wout de zeeuw
        wrote on last edited by
        #7

        Yes, the comment is quite bad... He should have also commented the four spaces preceding the closing bracket, what a slacker! :laugh:

        Wout

        1 Reply Last reply
        0
        • F Florin Jurcovici

          I mean, the programmer leaving this line in code:

          }//-- code block ends here
          

          I suppose lightning up a dull Monday?

          W Offline
          W Offline
          wizardzz
          wrote on last edited by
          #8

          But, but, it took him an hour to find the missing close bracket. Might as well comment it!

          1 Reply Last reply
          0
          • K Kschuler

            I don't know. There are some times where this would be extremely helpful. Usually about 4:50 PM on a Friday.

            K Offline
            K Offline
            Keith Barrow
            wrote on last edited by
            #9

            That was my first thought. Though not the 4:50 bit, guessing the same time like that would be weird, but Friday Afternoon would have been my call.

            Sort of a cross between Lawrence of Arabia and Dilbert.[^]
            -Or-
            A Dead ringer for Kate Winslett[^]

            K 1 Reply Last reply
            0
            • F Florin Jurcovici

              I mean, the programmer leaving this line in code:

              }//-- code block ends here
              

              I suppose lightning up a dull Monday?

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

              The best thing about this particular example is that it doesn't even tell you which code block it is closing!

              A 1 Reply Last reply
              0
              • K Keith Barrow

                That was my first thought. Though not the 4:50 bit, guessing the same time like that would be weird, but Friday Afternoon would have been my call.

                Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                -Or-
                A Dead ringer for Kate Winslett[^]

                K Offline
                K Offline
                Kschuler
                wrote on last edited by
                #11

                I didn't mean 4:50 exactly...but they always call with the tough urgent fixes when you have ten to twenty minutes left until the weekend and your brain is swiss cheese from the long busy week.

                1 Reply Last reply
                0
                • J jim lahey

                  Our apprentices code like that. I get ones like this checked in regularly:

                  //parses the datetime
                  var dateTime = DateTime.Parse(txtDate.Text);

                  I used to comment most lines many years ago, before I became familiar with what I was doing. Then I realised it's a lot quicker and a lot less effort to simply read your code.

                  A Offline
                  A Offline
                  Albert Holguin
                  wrote on last edited by
                  #12

                  jim lahey wrote:

                  read your code

                  Just keep in mind you're not the only one that has to read your code... I comment blocks of code (versus lines) but still commenting helps even me out when I revisit the code later.

                  F 1 Reply Last reply
                  0
                  • B BobJanova

                    The best thing about this particular example is that it doesn't even tell you which code block it is closing!

                    A Offline
                    A Offline
                    Albert Holguin
                    wrote on last edited by
                    #13

                    yep... noticed that too... I use that for #ifdef conditionals since they're not indented... but even I have enough sense to say which one I closed

                    1 Reply Last reply
                    0
                    • F Florin Jurcovici

                      I mean, the programmer leaving this line in code:

                      }//-- code block ends here
                      

                      I suppose lightning up a dull Monday?

                      E Offline
                      E Offline
                      Ennis Ray Lynch Jr
                      wrote on last edited by
                      #14

                      I comment the end of my code blocks. Sometimes they get nested. When you have two using statements, an if statement, a try catch, finally, and a while loop all mixed together it gets helpful.

                      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                      1 Reply Last reply
                      0
                      • F Florin Jurcovici

                        I mean, the programmer leaving this line in code:

                        }//-- code block ends here
                        

                        I suppose lightning up a dull Monday?

                        D Offline
                        D Offline
                        Dan Neely
                        wrote on last edited by
                        #15

                        He was probably raging at the elephanting sunshine who wrote the >1000 line method with broken indenting; and the coding policies that forbid making anything beyond the minimum possible change to fix a bug/implement a feature (meaning whitespace fix, or breaking into 20 smaller logical functions).

                        Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                        F 1 Reply Last reply
                        0
                        • A Albert Holguin

                          jim lahey wrote:

                          read your code

                          Just keep in mind you're not the only one that has to read your code... I comment blocks of code (versus lines) but still commenting helps even me out when I revisit the code later.

                          F Offline
                          F Offline
                          Florin Jurcovici
                          wrote on last edited by
                          #16

                          While I personally too prefer to read code, rather than comments (especially since the compiler checks my code but not my comments), I don't mind the occasional meaningful comment (although I am eager to delete comments when I spot them, provided the code they explain is self-describing). But stuff like the // parses the date in the post above, or } // code block ends here are IMO just a sign of sloppiness and lack of understanding of what comments are really for.

                          A 1 Reply Last reply
                          0
                          • D Dan Neely

                            He was probably raging at the elephanting sunshine who wrote the >1000 line method with broken indenting; and the coding policies that forbid making anything beyond the minimum possible change to fix a bug/implement a feature (meaning whitespace fix, or breaking into 20 smaller logical functions).

                            Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                            F Offline
                            F Offline
                            Florin Jurcovici
                            wrote on last edited by
                            #17

                            C'mon, the method was only 300+ lines longs ... and he wrote it himself.

                            1 Reply Last reply
                            0
                            • F Florin Jurcovici

                              While I personally too prefer to read code, rather than comments (especially since the compiler checks my code but not my comments), I don't mind the occasional meaningful comment (although I am eager to delete comments when I spot them, provided the code they explain is self-describing). But stuff like the // parses the date in the post above, or } // code block ends here are IMO just a sign of sloppiness and lack of understanding of what comments are really for.

                              A Offline
                              A Offline
                              Albert Holguin
                              wrote on last edited by
                              #18

                              Yeah but that's an extreme case.... the other side of that is someone who assumes that all their code is readable and interpretable by other people. An engineer that I'm working with now is really bothered by the fact that someone used "fs" to stand for file something or another (can't remember exactly) but to those of us in telecommunications, that's usually used for sampling frequency. In another words, your self-commenting code might not mean the same thing to someone else, so just be mindful of that.

                              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