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 are the worst programming habits?

What are the worst programming habits?

Scheduled Pinned Locked Moved The Lounge
helpquestion
152 Posts 69 Posters 83 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.
  • C Chris Maunder

    I was thinking about the things that bug me and came up with a short list

    1. No comments. I know - let's have a religious war etc, but I find no comments dangerous.
    2. using o as a variable name. In fact using anything that's not sensible. ctx, dr_rfp_ptr, i2
    3. Bad formatting. It's like walking into a house and being unable to sit down because of empty pizza boxes on the couch
    4. Mystery side-effects in code.
    5. Magic numbers

    I'm guilty of 2 of these on occasion. What's your list?

    cheers Chris Maunder

    R Offline
    R Offline
    RafagaX
    wrote on last edited by
    #141

    I think i'm guilty of the first one, although I usually only comment when it's not clear what the code does or it may have some unintended side effects.

    CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

    1 Reply Last reply
    0
    • C Chris Maunder

      I was thinking about the things that bug me and came up with a short list

      1. No comments. I know - let's have a religious war etc, but I find no comments dangerous.
      2. using o as a variable name. In fact using anything that's not sensible. ctx, dr_rfp_ptr, i2
      3. Bad formatting. It's like walking into a house and being unable to sit down because of empty pizza boxes on the couch
      4. Mystery side-effects in code.
      5. Magic numbers

      I'm guilty of 2 of these on occasion. What's your list?

      cheers Chris Maunder

      R Offline
      R Offline
      R Erasmus
      wrote on last edited by
      #142

      Using too many if-statements where better suitable mechanism could be used instead.

      "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

      1 Reply Last reply
      0
      • P PIEBALDconsult

        In order of how I have them listed below: 0) Use of VB. 1) Use of Convert and/or ToString rather than casting and/or Parsing. 2) Over-use of Reflection. Not caching and reusing information retrieved via Reflection. 3) Over-reliance on tools, especially third-party tools. 4) Monolithic classes, lack of modularity, non-single-responsibility. 5) Singletons. X| 6) Convoluted concatenation -- a String.Format will be clearer. 6.1) Concatenated SQL statements, when a parameterized statement is better on so many levels. 7) Not leveraging interfaces. 8) Not allowing polymorphism for no apparent reason. 9) Swallowing Exceptions. 10) Posting snippets of code that use uncommon, custon, or third-party classes and expecting everyone to know what they are.

        You'll never get very far if all you do is follow instructions.

        C Offline
        C Offline
        CHill60
        wrote on last edited by
        #143

        Quote:

        1. Swallowing Exceptions

        My number 1 pet hate. Should be in capitals. //BUT THAT IS SOMETHING ELSE THAT'S ANNOYING IN COMMENTS Plz 4giv me shtng :-D

        1 Reply Last reply
        0
        • C Chris Maunder

          I was thinking about the things that bug me and came up with a short list

          1. No comments. I know - let's have a religious war etc, but I find no comments dangerous.
          2. using o as a variable name. In fact using anything that's not sensible. ctx, dr_rfp_ptr, i2
          3. Bad formatting. It's like walking into a house and being unable to sit down because of empty pizza boxes on the couch
          4. Mystery side-effects in code.
          5. Magic numbers

          I'm guilty of 2 of these on occasion. What's your list?

          cheers Chris Maunder

          M Offline
          M Offline
          moonwalker72067
          wrote on last edited by
          #144

          ctx - it is assumed that it should point to some context structure, it is(should; may) not variable in usual sense but rather - the function parameter so it may be "pure functional".

          1 Reply Last reply
          0
          • C Chris Maunder

            I was thinking about the things that bug me and came up with a short list

            1. No comments. I know - let's have a religious war etc, but I find no comments dangerous.
            2. using o as a variable name. In fact using anything that's not sensible. ctx, dr_rfp_ptr, i2
            3. Bad formatting. It's like walking into a house and being unable to sit down because of empty pizza boxes on the couch
            4. Mystery side-effects in code.
            5. Magic numbers

            I'm guilty of 2 of these on occasion. What's your list?

            cheers Chris Maunder

            N Offline
            N Offline
            Naoya Yamaguchi
            wrote on last edited by
            #145

            I have nothing to say against use of comments. They may not be necessary for some, but usually do no harm to anyone. I believe programmers are free to choose any name for a variable so long as they communicate well to people you work with. Using "o" is fine. If it's a problem, change your font. Bad formatting used to a bad practice, but nowadays, we have apps and services to make them neat.

            1 Reply Last reply
            0
            • J Jorgen Andersson

              How about the SingleOrDefault on the same machine?

              Wrong is evil and must be defeated. - Jeff Ello[^]

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

              I'm not sure what you mean - the timings were all on the same machine.

              PooperPig - Coming Soon

              J 1 Reply Last reply
              0
              • L Lost User

                I'm not sure what you mean - the timings were all on the same machine.

                PooperPig - Coming Soon

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

                I was just curious on the performance of SingleOrDefault vs FirstOrDefault as per Petes suggestion.

                Wrong is evil and must be defeated. - Jeff Ello[^]

                L 1 Reply Last reply
                0
                • J Jorgen Andersson

                  I was just curious on the performance of SingleOrDefault vs FirstOrDefault as per Petes suggestion.

                  Wrong is evil and must be defeated. - Jeff Ello[^]

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

                  Oh - I see. I didn't do that - the figures were from a test I did some time ago when someone kept going through our code base changing all the .where(predicate).something() to .something(predicate) because they said it was more efficient - which I didn't think was the case.

                  PooperPig - Coming Soon

                  1 Reply Last reply
                  0
                  • Richard Andrew x64R Richard Andrew x64

                    6. Leaving commented-out code hanging around too long I'm guilty of that one quite often.

                    The difficult we do right away... ...the impossible takes slightly longer.

                    G Offline
                    G Offline
                    GSN CP
                    wrote on last edited by
                    #149

                    same goes for me!

                    .:>GSN<:.

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      I was thinking about the things that bug me and came up with a short list

                      1. No comments. I know - let's have a religious war etc, but I find no comments dangerous.
                      2. using o as a variable name. In fact using anything that's not sensible. ctx, dr_rfp_ptr, i2
                      3. Bad formatting. It's like walking into a house and being unable to sit down because of empty pizza boxes on the couch
                      4. Mystery side-effects in code.
                      5. Magic numbers

                      I'm guilty of 2 of these on occasion. What's your list?

                      cheers Chris Maunder

                      R Offline
                      R Offline
                      Ravi Bhavnani
                      wrote on last edited by
                      #150

                      Thanks for this week's survey - it's great! :thumbsup: /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        6. Leaving commented-out code hanging around too long I'm guilty of that one quite often.

                        The difficult we do right away... ...the impossible takes slightly longer.

                        L Offline
                        L Offline
                        Luiz Monad
                        wrote on last edited by
                        #151

                        Too long? I want to kill you if you don't delete old code. That's why we have (I have, but it's hard to convince people to use) version control. There should be 0 old code commented. One time I just deleted all comments that where not proper "human" language, except for code examples, because they're the only exception to having code in comments.

                        Richard Andrew x64R 1 Reply Last reply
                        0
                        • L Luiz Monad

                          Too long? I want to kill you if you don't delete old code. That's why we have (I have, but it's hard to convince people to use) version control. There should be 0 old code commented. One time I just deleted all comments that where not proper "human" language, except for code examples, because they're the only exception to having code in comments.

                          Richard Andrew x64R Offline
                          Richard Andrew x64R Offline
                          Richard Andrew x64
                          wrote on last edited by
                          #152

                          Luiz Felipe Stangarlin wrote:

                          I want to kill you if you don't delete old code.

                          Maybe you should cut down on the caffeine? ;P

                          The difficult we do right away... ...the impossible takes slightly longer.

                          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