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. Coding pet hates

Coding pet hates

Scheduled Pinned Locked Moved The Lounge
jsonquestion
58 Posts 27 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.
  • OriginalGriffO OriginalGriff

    :thumbsup: I prefer

    if ()
    {
    ...
    }

    But what annoys me is

    if(condition) statement;

    because I expect to see the following statement(s) as the conditionally executed ones. Though to be honest, I'll stick with anything consistent - it better than a mix of styles. That's one of the things I like about VS - it can reformat the code to match your personal preference. Unfortunately, that counts as a change for SVN...

    I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

    M Offline
    M Offline
    mattiek77
    wrote on last edited by
    #40

    if (x == y)
    {
    //no action needed
    }
    else
    {
    // do stuff
    x++;
    }

    Regardless of layout any empty conditional. :rolleyes:

    1 Reply Last reply
    0
    • S Simon P Stevens

      Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.

      Simon

      W Offline
      W Offline
      WiGgLr
      wrote on last edited by
      #41

      Simon P Stevens wrote:

      Check out Regionerate[^]. It re-orders all you class members, properties, methods etc, into a specified order. Supports with and without regions modes.

      I've always used the cr_classcleaner[^] dxcore plugin for this, although it means configuring a keyboard shortcut for it.

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        :thumbsup: I prefer

        if ()
        {
        ...
        }

        But what annoys me is

        if(condition) statement;

        because I expect to see the following statement(s) as the conditionally executed ones. Though to be honest, I'll stick with anything consistent - it better than a mix of styles. That's one of the things I like about VS - it can reformat the code to match your personal preference. Unfortunately, that counts as a change for SVN...

        I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #42

        Curses on you. :) I just went shopping (Tesco) and you'll never guess what was on special. Yup, Soreen Fruity Malty. 2 for a quid and well........ I mean I just had to.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        OriginalGriffO 1 Reply Last reply
        0
        • L Lost User

          Near the top of my list of pet hates is unnecessary white space changes. You're looking at a piece of code thinking *why?*, so you go and look who last touched the line. Then you look at the rest of that check in and think this is totally unrelated. So you go and look at what they actually changed in the line of code only to find they added a tab on the end. Arrrrhhhhhgggggg. Start again with revision number-- What gives you the shits on a friday afternoon?

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

          "We have no coding standards; you can do whatever you want." ::write code:: "Oh, we don't do it that way here." :mad:

          1 Reply Last reply
          0
          • M Marc Clifton

            I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's. My other is when people pay no attention to the structure of the code and put fields, properties, public and private methods into an unorganized pile of dung. Yes, obviously the compiler couldn't care less, but we're writing code for each other, and I like a certain structure to my classes. So, my other pet pieve is when people, who come into a project and should be humble and respectful to the work others have already done, totally ignore it, not just structure but naming conventions, indentation conventions, etc. I can write coding standards until I'm blue in the face and their still ignored, but the code itself shows what the standards are if people just took the time to look at it and left their egos at the door. There should be a new branch of psychology for programmers. So, is it possible that your use of underscores is because you feel inadequate with your partner? Are you placing fields willy-nilly in the class because you were bottle fed and lack the ability to empathize with your fellow human being? Do you use lowercase method names because you were taunted by your peers as a child? Marc

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #44

            Marc Clifton wrote:

            I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's.

            Marc, It's part of the .NET framework guidelines to use this. to distinguish type members from locals. So maybe not everyone uses it merely for intellisense. The default Style Cop rules will warn you if you forget to prefix this. to a member field/method.

            Regards, Nish


            Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

            M 1 Reply Last reply
            0
            • R Russell Jones

              Ian Shlasko wrote:

              And if it was a little bit more complicated, but still one line...

              if (flag & (otherThing | somethingElse))
              x = 9387523 / blah + 34028;

              i've seen a tab cause errors here where someone does this:

              And if it was a little bit more complicated, but still one line...

              if (flag & (otherThing | somethingElse))
              x = 9387523 / blah + 34028;
              y = 0;

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

              If I do that, then hit Ctrl+K,Ctrl+D (Edit, Advanced, Format Document), that last line magically jumps back to align itself with the "if" :)

              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
              • L Lost User

                Near the top of my list of pet hates is unnecessary white space changes. You're looking at a piece of code thinking *why?*, so you go and look who last touched the line. Then you look at the rest of that check in and think this is totally unrelated. So you go and look at what they actually changed in the line of code only to find they added a tab on the end. Arrrrhhhhhgggggg. Start again with revision number-- What gives you the shits on a friday afternoon?

                K Offline
                K Offline
                Kevin Marois
                wrote on last edited by
                #46

                What gives you the shits on a friday afternoon? An enema?

                Everything makes sense in someone's mind

                1 Reply Last reply
                0
                • L Lost User

                  Near the top of my list of pet hates is unnecessary white space changes. You're looking at a piece of code thinking *why?*, so you go and look who last touched the line. Then you look at the rest of that check in and think this is totally unrelated. So you go and look at what they actually changed in the line of code only to find they added a tab on the end. Arrrrhhhhhgggggg. Start again with revision number-- What gives you the shits on a friday afternoon?

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #47

                  I hate that my pet Python [^]ate my Mouse[^]. That wasn't Nice[^]. I tried to talk it out of the Action![^] but I'm no Shakespeare [^]and all I could muster was Smalltalk[^]. I tried to keep Cool[^] and not spill my Cola[^], this was not going to be easy[^]. As I was thinking, it found a gap[^] and attacked a Squirrel[^], all I could hear was a squeak [^]as it rose an Octave[^] or two.

                  N 1 Reply Last reply
                  0
                  • N Nish Nishant

                    Marc Clifton wrote:

                    I have a few, but at the top of the list are using "this." to get Intellisense to trigger, which is an obsolete habit from older IDE's.

                    Marc, It's part of the .NET framework guidelines to use this. to distinguish type members from locals. So maybe not everyone uses it merely for intellisense. The default Style Cop rules will warn you if you forget to prefix this. to a member field/method.

                    Regards, Nish


                    Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

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

                    Nishant Sivakumar wrote:

                    It's part of the .NET framework guidelines to use this. to distinguish type members from locals.

                    Good point, and I march to a different drummer. :) Marc

                    N 1 Reply Last reply
                    0
                    • M Marc Clifton

                      Nishant Sivakumar wrote:

                      It's part of the .NET framework guidelines to use this. to distinguish type members from locals.

                      Good point, and I march to a different drummer. :) Marc

                      N Offline
                      N Offline
                      Nish Nishant
                      wrote on last edited by
                      #49

                      Marc Clifton wrote:

                      Good point, and I march to a different drummer.

                      Fair enough. But the few times that I tried to be StyleCop compliant, I actually found that prefixing this. made the code more readable (for me). Of course it's a very subjective thing so I am sure not everyone'll have the same experience. :)

                      Regards, Nish


                      Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

                      M 1 Reply Last reply
                      0
                      • N Nish Nishant

                        Marc Clifton wrote:

                        Good point, and I march to a different drummer.

                        Fair enough. But the few times that I tried to be StyleCop compliant, I actually found that prefixing this. made the code more readable (for me). Of course it's a very subjective thing so I am sure not everyone'll have the same experience. :)

                        Regards, Nish


                        Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

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

                        Nishant Sivakumar wrote:

                        I actually found that prefixing this. made the code more readable (for me).

                        I suspect I could adapt to it, as long as I wasn't coding in VB. Prefacing everything with "My." would be a bit too narcissistic for my tastes. :) Marc

                        N 1 Reply Last reply
                        0
                        • M Marc Clifton

                          Nishant Sivakumar wrote:

                          I actually found that prefixing this. made the code more readable (for me).

                          I suspect I could adapt to it, as long as I wasn't coding in VB. Prefacing everything with "My." would be a bit too narcissistic for my tastes. :) Marc

                          N Offline
                          N Offline
                          Nish Nishant
                          wrote on last edited by
                          #51

                          Marc Clifton wrote:

                          I suspect I could adapt to it, as long as I wasn't coding in VB. Prefacing everything with "My." would be a bit too narcissistic for my tastes.

                          :-D My is their namespace, Me is their this-pointer!

                          Regards, Nish


                          Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

                          M 1 Reply Last reply
                          0
                          • N Nish Nishant

                            Marc Clifton wrote:

                            I suspect I could adapt to it, as long as I wasn't coding in VB. Prefacing everything with "My." would be a bit too narcissistic for my tastes.

                            :-D My is their namespace, Me is their this-pointer!

                            Regards, Nish


                            Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

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

                            Nishant Sivakumar wrote:

                            Me is their this-pointer!

                            Oops. I was thinking "My" wasn't right! Marc

                            1 Reply Last reply
                            0
                            • N Not Active

                              I hate that my pet Python [^]ate my Mouse[^]. That wasn't Nice[^]. I tried to talk it out of the Action![^] but I'm no Shakespeare [^]and all I could muster was Smalltalk[^]. I tried to keep Cool[^] and not spill my Cola[^], this was not going to be easy[^]. As I was thinking, it found a gap[^] and attacked a Squirrel[^], all I could hear was a squeak [^]as it rose an Octave[^] or two.

                              N Offline
                              N Offline
                              NormDroid
                              wrote on last edited by
                              #53

                              My eyes my poor freakin eyes. :)

                              Two heads are better than one.

                              1 Reply Last reply
                              0
                              • L Lost User

                                digital man wrote:

                                5 cups of coffee and 6 Krispy Kremes[^]... Smile

                                ha We had a Krispy Kreame eating contest at the office once. The challenge was to be the first to eat a dozen orginials in 5 mins, spectators paid $5 to watch with the winner taking all. It's not as easy as it sounds, I came 2nd with 8.5 eaten and I've never felt so sick. Talk about a sugar rush.

                                E Offline
                                E Offline
                                Ed Poore
                                wrote on last edited by
                                #54

                                Let me introduce you to a couple of the graduates who are on our shooting club's committee. It'd be a snack to them. I've been a couple of times with them - once which will always stay in my mind is when we went to Bodeans[^] and the waiter thought they were joking when they ordered two plates of ribs a piece for their starters.


                                I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder

                                1 Reply Last reply
                                0
                                • H Henry Minute

                                  Curses on you. :) I just went shopping (Tesco) and you'll never guess what was on special. Yup, Soreen Fruity Malty. 2 for a quid and well........ I mean I just had to.

                                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                                  OriginalGriffO Offline
                                  OriginalGriffO Offline
                                  OriginalGriff
                                  wrote on last edited by
                                  #55

                                  Hope you got plenty of good butter too - not that "mock butter" stuff, it never tastes right!

                                  I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

                                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                  1 Reply Last reply
                                  0
                                  • I Ian Shlasko

                                    Ugh, I hate those kinds of standards... I use #regions for logical groupings, not categorization by type... If a code file is so large that it really needs to be broken down into "Fields" sections and "Properties" sections, then it's time to split it into multiple files... Partial classes are your friend. And if you find yourself making more than a few partials, then MAYBE it's time to split that class up into smaller components.

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

                                    OriginalGriffO Offline
                                    OriginalGriffO Offline
                                    OriginalGriff
                                    wrote on last edited by
                                    #56

                                    Its not a question of size - I agree with you on the partial classes wholeheartedly. It's more a "visibility" thing - outlining can collapse a region to a single on screen line, and since you can't open two proper windows on the same source file (Split Window doesn't do it for me, I used Brief for DOS) that helps a bit. It's a personal preference thing, I think.

                                    I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

                                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                                    I 1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      Its not a question of size - I agree with you on the partial classes wholeheartedly. It's more a "visibility" thing - outlining can collapse a region to a single on screen line, and since you can't open two proper windows on the same source file (Split Window doesn't do it for me, I used Brief for DOS) that helps a bit. It's a personal preference thing, I think.

                                      I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

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

                                      Right, but I find it more useful to collapse/expand things based on their logical function, not just based on whether they're a function or a property... If you have a property with a few fields behind it, put the fields with the property... If you have a few functions and properties dealing with rendering, put those in a region... Makes more sense to me.

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

                                      D 1 Reply Last reply
                                      0
                                      • I Ian Shlasko

                                        Right, but I find it more useful to collapse/expand things based on their logical function, not just based on whether they're a function or a property... If you have a property with a few fields behind it, put the fields with the property... If you have a few functions and properties dealing with rendering, put those in a region... Makes more sense to me.

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

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

                                        Visual Studio! Eclipse! Emacs! Vi! Logic probe on data bus!!!! :rolleyes:

                                        3x12=36 2x12=24 1x12=12 0x12=18

                                        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