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 Peeves

Coding Pet Peeves

Scheduled Pinned Locked Moved The Lounge
wpfhelpquestion
55 Posts 38 Posters 7 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    1. I just can stand it when someone doesn't use braces in IF statements:

    static void Main(string[] args)
    {
    bool isTrue = false;

        if (isTrue)
            Console.WriteLine("line1") ;
            Console.WriteLine("line2");
            Console.WriteLine("line3");
    
        Console.ReadLine();
    

    }

    2. XAML where the code is all on one line! (This is all on one line!)

    3. First brace not on a new line:

    static void Main(string[] args)
    {
    bool isTrue = false;

        if (isTrue) {
            Console.WriteLine("line1");
        }
        Console.WriteLine("line2");
        Console.WriteLine("line3");
    
        Console.ReadLine();
    

    }

    What bugs you when you see someone else's code?

    In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

    J M M C R 28 Replies Last reply
    0
    • K Kevin Marois

      1. I just can stand it when someone doesn't use braces in IF statements:

      static void Main(string[] args)
      {
      bool isTrue = false;

          if (isTrue)
              Console.WriteLine("line1") ;
              Console.WriteLine("line2");
              Console.WriteLine("line3");
      
          Console.ReadLine();
      

      }

      2. XAML where the code is all on one line! (This is all on one line!)

      3. First brace not on a new line:

      static void Main(string[] args)
      {
      bool isTrue = false;

          if (isTrue) {
              Console.WriteLine("line1");
          }
          Console.WriteLine("line2");
          Console.WriteLine("line3");
      
          Console.ReadLine();
      

      }

      What bugs you when you see someone else's code?

      In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

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

      #3 most definitely, #1 less so. Empty 'catch' blocks, ran into that fairly recently...:mad::mad::mad:

      "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 "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      J O 2 Replies Last reply
      0
      • K Kevin Marois

        1. I just can stand it when someone doesn't use braces in IF statements:

        static void Main(string[] args)
        {
        bool isTrue = false;

            if (isTrue)
                Console.WriteLine("line1") ;
                Console.WriteLine("line2");
                Console.WriteLine("line3");
        
            Console.ReadLine();
        

        }

        2. XAML where the code is all on one line! (This is all on one line!)

        3. First brace not on a new line:

        static void Main(string[] args)
        {
        bool isTrue = false;

            if (isTrue) {
                Console.WriteLine("line1");
            }
            Console.WriteLine("line2");
            Console.WriteLine("line3");
        
            Console.ReadLine();
        

        }

        What bugs you when you see someone else's code?

        In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

        M Offline
        M Offline
        Mircea Neacsu
        wrote on last edited by
        #3

        Kevin Marois wrote:

        What bugs you when you see someone else's code?

        1. "Hungarian" variable names 2. TAB instead of spaces 3. TAB instead of spaces ... 100. Did I mention "TAB instead of spaces"? :laugh:

        Mircea

        1 Reply Last reply
        0
        • K Kevin Marois

          1. I just can stand it when someone doesn't use braces in IF statements:

          static void Main(string[] args)
          {
          bool isTrue = false;

              if (isTrue)
                  Console.WriteLine("line1") ;
                  Console.WriteLine("line2");
                  Console.WriteLine("line3");
          
              Console.ReadLine();
          

          }

          2. XAML where the code is all on one line! (This is all on one line!)

          3. First brace not on a new line:

          static void Main(string[] args)
          {
          bool isTrue = false;

              if (isTrue) {
                  Console.WriteLine("line1");
              }
              Console.WriteLine("line2");
              Console.WriteLine("line3");
          
              Console.ReadLine();
          

          }

          What bugs you when you see someone else's code?

          In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

          C Offline
          C Offline
          charlieg
          wrote on last edited by
          #4

          Item 1 is just evil. Item 2 - it's xaml. It's not code ;) Item 3 - I prefer braces to be on the line below, but it's just habit. damned if I know where I picked up on that. I just don't think the opening brace on the same line is clear. But that is my preference. I know other folks that go BSC if the brace is under the if...

          Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

          J 1 Reply Last reply
          0
          • K Kevin Marois

            1. I just can stand it when someone doesn't use braces in IF statements:

            static void Main(string[] args)
            {
            bool isTrue = false;

                if (isTrue)
                    Console.WriteLine("line1") ;
                    Console.WriteLine("line2");
                    Console.WriteLine("line3");
            
                Console.ReadLine();
            

            }

            2. XAML where the code is all on one line! (This is all on one line!)

            3. First brace not on a new line:

            static void Main(string[] args)
            {
            bool isTrue = false;

                if (isTrue) {
                    Console.WriteLine("line1");
                }
                Console.WriteLine("line2");
                Console.WriteLine("line3");
            
                Console.ReadLine();
            

            }

            What bugs you when you see someone else's code?

            In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

            M Offline
            M Offline
            Mike Hankey
            wrote on last edited by
            #5

            1.2.3.YES

            Give me coffee to change the things I can and wine for those I can not! PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com Latest Article: Simon Says, A Child's Game

            1 Reply Last reply
            0
            • K Kevin Marois

              1. I just can stand it when someone doesn't use braces in IF statements:

              static void Main(string[] args)
              {
              bool isTrue = false;

                  if (isTrue)
                      Console.WriteLine("line1") ;
                      Console.WriteLine("line2");
                      Console.WriteLine("line3");
              
                  Console.ReadLine();
              

              }

              2. XAML where the code is all on one line! (This is all on one line!)

              3. First brace not on a new line:

              static void Main(string[] args)
              {
              bool isTrue = false;

                  if (isTrue) {
                      Console.WriteLine("line1");
                  }
                  Console.WriteLine("line2");
                  Console.WriteLine("line3");
              
                  Console.ReadLine();
              

              }

              What bugs you when you see someone else's code?

              In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

              R Offline
              R Offline
              Rick York
              wrote on last edited by
              #6

              Use of literal values annoys me a lot. Especially when that hard-coded value needs to be changed.

              "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

              J J H 3 Replies Last reply
              0
              • K Kevin Marois

                1. I just can stand it when someone doesn't use braces in IF statements:

                static void Main(string[] args)
                {
                bool isTrue = false;

                    if (isTrue)
                        Console.WriteLine("line1") ;
                        Console.WriteLine("line2");
                        Console.WriteLine("line3");
                
                    Console.ReadLine();
                

                }

                2. XAML where the code is all on one line! (This is all on one line!)

                3. First brace not on a new line:

                static void Main(string[] args)
                {
                bool isTrue = false;

                    if (isTrue) {
                        Console.WriteLine("line1");
                    }
                    Console.WriteLine("line2");
                    Console.WriteLine("line3");
                
                    Console.ReadLine();
                

                }

                What bugs you when you see someone else's code?

                In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

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

                Kevin Marois wrote:

                I just can stand it when someone doesn't use braces in IF statements:

                For me, that's acceptable... as long as the rest of the code is formatted well. Especially for stuff that's terse in nature like if (!blah) return; at the start of a routine. But it would have to be something short and simple.

                Kevin Marois wrote:

                What bugs you when you see someone else's code?

                If we harken back to the first point... when folks don't use spacing properly. Code should read like text. And in English we have paragraphs. When I see large code files with no blank lines... I mean... what?

                // bro... what
                function checkout(goodsPrice, shipmentPrice, taxes) {
                const total = goodsPrice + shipmentPrice + taxes;
                const para = document.createElement("p");
                para.textContent = `Total price is ${total}`;
                document.body.appendChild(para);
                }

                // paragraphs logically separate ideas, so should code
                function checkout(goodsPrice, shipmentPrice, taxes) {
                const total = goodsPrice + shipmentPrice + taxes;
                const para = document.createElement("p");

                para.textContent = `Total price is ${total}`;
                document.body.appendChild(para);
                }

                Jeremy Falcon

                1 Reply Last reply
                0
                • J jeron1

                  #3 most definitely, #1 less so. Empty 'catch' blocks, ran into that fairly recently...:mad::mad::mad:

                  "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 "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

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

                  Funny enough, for JavaScript it's the exact opposite for #3. My peeve would be not using 1TBS for JavaScript/Typescript. There's actually a technical reason why, but now it's just so ingrained. And it's easy to spot a JavaScript rookie vs a pro if they try and format it like C#. Totally agree about the empty catch blocks though. Even in JS.

                  Jeremy Falcon

                  D 1 Reply Last reply
                  0
                  • C charlieg

                    Item 1 is just evil. Item 2 - it's xaml. It's not code ;) Item 3 - I prefer braces to be on the line below, but it's just habit. damned if I know where I picked up on that. I just don't think the opening brace on the same line is clear. But that is my preference. I know other folks that go BSC if the brace is under the if...

                    Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

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

                    charlieg wrote:

                    Item 3 - I prefer braces to be on the line below, but it's just habit. damned if I know where I picked up on that. I just don't think the opening brace on the same line is clear. But that is my preference. I know other folks that go BSC if the brace is under the if...

                    Except in JavaScript (I realize the OP is C#... just saying) there's a legit reason to not use a new line for the brace.

                    Jeremy Falcon

                    M 1 Reply Last reply
                    0
                    • R Rick York

                      Use of literal values annoys me a lot. Especially when that hard-coded value needs to be changed.

                      "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

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

                      That's a good one. Especially if that literal is used more than once...

                      Jeremy Falcon

                      1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        Funny enough, for JavaScript it's the exact opposite for #3. My peeve would be not using 1TBS for JavaScript/Typescript. There's actually a technical reason why, but now it's just so ingrained. And it's easy to spot a JavaScript rookie vs a pro if they try and format it like C#. Totally agree about the empty catch blocks though. Even in JS.

                        Jeremy Falcon

                        D Offline
                        D Offline
                        dandy72
                        wrote on last edited by
                        #11

                        Agreed with the opening brace placement in JS/TS vs C#. I've done *very* little JS, but this is something I've quickly adopted, despite doing the opposite in C#. If I see an opening brace on a line on its own in JS, it just looks wrong to me. Somehow I can manage do the context switch in C# as if it was second nature, which is just as well, otherwise I'd really get stuck on this sort of thing. Coding standards are weird. It's just as well there's so many of them.............

                        J 1 Reply Last reply
                        0
                        • J Jeremy Falcon

                          charlieg wrote:

                          Item 3 - I prefer braces to be on the line below, but it's just habit. damned if I know where I picked up on that. I just don't think the opening brace on the same line is clear. But that is my preference. I know other folks that go BSC if the brace is under the if...

                          Except in JavaScript (I realize the OP is C#... just saying) there's a legit reason to not use a new line for the brace.

                          Jeremy Falcon

                          M Offline
                          M Offline
                          MarkTJohnson
                          wrote on last edited by
                          #12

                          Clicked on the link, read what was said there and pondered for a minute. I've decided that is one of the dumber language decisions I've ever seen.

                          I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                          J B 2 Replies Last reply
                          0
                          • D dandy72

                            Agreed with the opening brace placement in JS/TS vs C#. I've done *very* little JS, but this is something I've quickly adopted, despite doing the opposite in C#. If I see an opening brace on a line on its own in JS, it just looks wrong to me. Somehow I can manage do the context switch in C# as if it was second nature, which is just as well, otherwise I'd really get stuck on this sort of thing. Coding standards are weird. It's just as well there's so many of them.............

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

                            dandy72 wrote:

                            Somehow I can manage do the context switch in C# as if it was second nature

                            That's a sign of a good coder actually. Like with JS, there's a technical reason. Being able to let go of things (if there's a good reason) is a good thing. Like for instance, I love camel case. But, I doubt that would fly in Rust.

                            dandy72 wrote:

                            Coding standards are weird. It's just as well there's so many of them.............

                            Preach.

                            Jeremy Falcon

                            1 Reply Last reply
                            0
                            • M MarkTJohnson

                              Clicked on the link, read what was said there and pondered for a minute. I've decided that is one of the dumber language decisions I've ever seen.

                              I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

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

                              MarkTJohnson wrote:

                              I've decided that is one of the dumber language decisions I've ever seen.

                              People that dismiss JavaScript really just don't know it. Yes, it started off quickly/rushed, but it's come a long way. It's different. It's both functional and OOP. Nothing more. Nothing less. I think it's a great language, minus a few little quirks... which most languages have. It started off being web centric, so it has historic "issues" from that like ASI. Most web languages are script kiddie friendly, but JavaScript/ECMAScript has come a long, long way. I can promise you that most issues with the language is more so due to it being popular and 99% of people really knowing nothing about it. Not to mention, it's fast. Really fast, thanks to the optimizations over the years. Of course, not Rust/C++/C# fast... but it's one of the fastest scripting languages out there.

                              Jeremy Falcon

                              S J 2 Replies Last reply
                              0
                              • K Kevin Marois

                                1. I just can stand it when someone doesn't use braces in IF statements:

                                static void Main(string[] args)
                                {
                                bool isTrue = false;

                                    if (isTrue)
                                        Console.WriteLine("line1") ;
                                        Console.WriteLine("line2");
                                        Console.WriteLine("line3");
                                
                                    Console.ReadLine();
                                

                                }

                                2. XAML where the code is all on one line! (This is all on one line!)

                                3. First brace not on a new line:

                                static void Main(string[] args)
                                {
                                bool isTrue = false;

                                    if (isTrue) {
                                        Console.WriteLine("line1");
                                    }
                                    Console.WriteLine("line2");
                                    Console.WriteLine("line3");
                                
                                    Console.ReadLine();
                                

                                }

                                What bugs you when you see someone else's code?

                                In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

                                K Offline
                                K Offline
                                k5054
                                wrote on last edited by
                                #15

                                At least in C/C++ putting the opening bracket on the same line as a function definition

                                int f(int x) {
                                // ...
                                }

                                But that's OK in classes - particularly if its a one-liner

                                class C {
                                int x;
                                // ...
                                int f(int n) { return x*n; }
                                {;

                                Keep Calm and Carry On

                                1 Reply Last reply
                                0
                                • K Kevin Marois

                                  1. I just can stand it when someone doesn't use braces in IF statements:

                                  static void Main(string[] args)
                                  {
                                  bool isTrue = false;

                                      if (isTrue)
                                          Console.WriteLine("line1") ;
                                          Console.WriteLine("line2");
                                          Console.WriteLine("line3");
                                  
                                      Console.ReadLine();
                                  

                                  }

                                  2. XAML where the code is all on one line! (This is all on one line!)

                                  3. First brace not on a new line:

                                  static void Main(string[] args)
                                  {
                                  bool isTrue = false;

                                      if (isTrue) {
                                          Console.WriteLine("line1");
                                      }
                                      Console.WriteLine("line2");
                                      Console.WriteLine("line3");
                                  
                                      Console.ReadLine();
                                  

                                  }

                                  What bugs you when you see someone else's code?

                                  In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

                                  Greg UtasG Offline
                                  Greg UtasG Offline
                                  Greg Utas
                                  wrote on last edited by
                                  #16

                                  It's not exactly code, but comment boxes in the form of complete rectangles. The pinheads who originally drew them presumably believed that other people adding comments in the box would bother to keep its right-hand border nicely aligned. Not to mention that many of those comments provided a revision history for even the most trivial changes when, even in 1981, we had a source code management system that provided a full history, so that you could see who made each change, why, and get a diff between whichever versions you wanted.

                                  Robust Services Core | Software Techniques for Lemmings | Articles
                                  The fox knows many things, but the hedgehog knows one big thing.

                                  <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                                  <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                                  P J 2 Replies Last reply
                                  0
                                  • J Jeremy Falcon

                                    MarkTJohnson wrote:

                                    I've decided that is one of the dumber language decisions I've ever seen.

                                    People that dismiss JavaScript really just don't know it. Yes, it started off quickly/rushed, but it's come a long way. It's different. It's both functional and OOP. Nothing more. Nothing less. I think it's a great language, minus a few little quirks... which most languages have. It started off being web centric, so it has historic "issues" from that like ASI. Most web languages are script kiddie friendly, but JavaScript/ECMAScript has come a long, long way. I can promise you that most issues with the language is more so due to it being popular and 99% of people really knowing nothing about it. Not to mention, it's fast. Really fast, thanks to the optimizations over the years. Of course, not Rust/C++/C# fast... but it's one of the fastest scripting languages out there.

                                    Jeremy Falcon

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

                                    Replying/preaching 6 times in one these types of threads - interesting. Trying to defend javascript - priceless.

                                    J 1 Reply Last reply
                                    0
                                    • S Slacker007

                                      Replying/preaching 6 times in one these types of threads - interesting. Trying to defend javascript - priceless.

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

                                      Slacker007 wrote:

                                      Trying to defend javascript - priceless.

                                      :laugh: :laugh: :laugh: Always man.

                                      Jeremy Falcon

                                      G 1 Reply Last reply
                                      0
                                      • K Kevin Marois

                                        1. I just can stand it when someone doesn't use braces in IF statements:

                                        static void Main(string[] args)
                                        {
                                        bool isTrue = false;

                                            if (isTrue)
                                                Console.WriteLine("line1") ;
                                                Console.WriteLine("line2");
                                                Console.WriteLine("line3");
                                        
                                            Console.ReadLine();
                                        

                                        }

                                        2. XAML where the code is all on one line! (This is all on one line!)

                                        3. First brace not on a new line:

                                        static void Main(string[] args)
                                        {
                                        bool isTrue = false;

                                            if (isTrue) {
                                                Console.WriteLine("line1");
                                            }
                                            Console.WriteLine("line2");
                                            Console.WriteLine("line3");
                                        
                                            Console.ReadLine();
                                        

                                        }

                                        What bugs you when you see someone else's code?

                                        In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

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

                                        I would take offense to #1 and #2, but not #3.  I use the K&R style of bracing. /ravi

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

                                        D 1 Reply Last reply
                                        0
                                        • K Kevin Marois

                                          1. I just can stand it when someone doesn't use braces in IF statements:

                                          static void Main(string[] args)
                                          {
                                          bool isTrue = false;

                                              if (isTrue)
                                                  Console.WriteLine("line1") ;
                                                  Console.WriteLine("line2");
                                                  Console.WriteLine("line3");
                                          
                                              Console.ReadLine();
                                          

                                          }

                                          2. XAML where the code is all on one line! (This is all on one line!)

                                          3. First brace not on a new line:

                                          static void Main(string[] args)
                                          {
                                          bool isTrue = false;

                                              if (isTrue) {
                                                  Console.WriteLine("line1");
                                              }
                                              Console.WriteLine("line2");
                                              Console.WriteLine("line3");
                                          
                                              Console.ReadLine();
                                          

                                          }

                                          What bugs you when you see someone else's code?

                                          In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.

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

                                          I have enough trouble with my own code... :sigh:

                                          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