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 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
    Marc Clifton
    wrote on last edited by
    #21

    #1 and #3, except #3 is the style for JavaScript/TypeScript, so I have to live with it. :( #2 - I don't do XAML but yes, I would agree.

    Latest Articles:
    A Lightweight Thread Safe In-Memory Keyed Generic Cache Collection Service A Dynamic Where Implementation for Entity Framework

    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.

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

      Position first attribute on same line as start tag.

      "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

      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.

        A Offline
        A Offline
        Anthony Jackson 2021
        wrote on last edited by
        #23

        I program in VB6..... so none of this matters!!! :-D :-D :-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.

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #24

          I just follow the house coding standards whatever they are, which just ensures the coding style is consistent across the department. I am not a fan of one line if statements unless the statement is on the same line as the condition.

          “That which can be asserted without evidence, can be dismissed without evidence.”

          ― Christopher Hitchens

          1 Reply Last reply
          0
          • Greg UtasG Greg Utas

            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 Offline
            P Offline
            Peter Adam
            wrote on last edited by
            #25

            But where is that VCS today? The source probably is still here. It feels so good to look at the header in a file originally committed into Jedi VCS years later checked in into an SVN repo with no option to keep the history to see where our journey began.

            Greg UtasG 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.

              L Offline
              L Offline
              Lorenzo Bertolino
              wrote on last edited by
              #26

              #1 I have no issues at all with the absence of braces but code must be indented correctly at ALL times, no excuses or exceptions #2 I don't really care, maybe I'd enable auto wrap or reformat the code to do it, luckily I don't see it often #3 just for C#, for C++ I prefer on the same line and even for C# it's just because there is a preferred style and it would be dumb to go against the current, if it wasn't for that, braces would be on the same line

              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.

                V Offline
                V Offline
                V 0
                wrote on last edited by
                #27

                inconsistant naming. :doh:

                V.

                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.

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

                  People who go against the editor's defaults X| I'm currently working on a project where the developer uses two spaces instead of the default four. So now, whenever I change a file and I save it, Visual Studio reformats the entire file to have four spaces. We're now working with editorconfig files... Same for curly braces on the same line, seen it before and Visual Studio just keeps trying to correct me. At one time I've even seen a project where curly braces and semi-colons were always aligned to the end of a line, like on column 800 or something :~ How the :elephant: does someone think "let's mess up the VS settings before starting to write code!" and then go all out of his way to have such an unnatural coding style X|

                  Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                  R H 2 Replies Last reply
                  0
                  • P Peter Adam

                    But where is that VCS today? The source probably is still here. It feels so good to look at the header in a file originally committed into Jedi VCS years later checked in into an SVN repo with no option to keep the history to see where our journey began.

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

                    It was a proprietary VCS that is still in use. Some former colleagues are still using it, and some of my commits would probably still be there over 20 years later! Once released software had been proven for long enough, most of the history in that release would be deleted to free up storage space, which was at more of a premium back then. Code ownership was part of the culture, so one thing it supported was ownership of each code file by a user group, so that only members of the group could "open" a file for a commit. A file in the OPEN state also served as a warning so that anyone working on a private copy could consult with the developer changing the code to avoid merge conflicts.

                    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>

                    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
                      CPallini
                      wrote on last edited by
                      #30

                      It is not my usual messy stuff...

                      "In testa che avete, Signor di Ceprano?" -- Rigoletto

                      1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        Slacker007 wrote:

                        Trying to defend javascript - priceless.

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

                        Jeremy Falcon

                        G Offline
                        G Offline
                        Gary Wheeler
                        wrote on last edited by
                        #31

                        Jeremy Quixote, I presume? :-D

                        Software Zen: delete this;

                        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
                          megaadam
                          wrote on last edited by
                          #32

                          Kevin Marois wrote:

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

                          I find improper find grammar unbearable! :cool:

                          "If we don't change direction, we'll end up where we're going"

                          1 Reply Last reply
                          0
                          • R Ravi Bhavnani

                            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 Offline
                            D Offline
                            darktrick544
                            wrote on last edited by
                            #33

                            I agree

                            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
                              Paul Sanders the other one
                              wrote on last edited by
                              #34

                              Quite happy about `if` one-liners, religious about #3. And only comment that which is not obvious.

                              Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                              1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                People who go against the editor's defaults X| I'm currently working on a project where the developer uses two spaces instead of the default four. So now, whenever I change a file and I save it, Visual Studio reformats the entire file to have four spaces. We're now working with editorconfig files... Same for curly braces on the same line, seen it before and Visual Studio just keeps trying to correct me. At one time I've even seen a project where curly braces and semi-colons were always aligned to the end of a line, like on column 800 or something :~ How the :elephant: does someone think "let's mess up the VS settings before starting to write code!" and then go all out of his way to have such an unnatural coding style X|

                                Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                                R Offline
                                R Offline
                                Rich Shealer
                                wrote on last edited by
                                #35

                                I prefer the two-space indent over four because it saves screen space. Visual Studio has a lot of useful windows surrounding the text editor. Using two-space indents allows more text to be seen. Some of my colleagues and I have used two as the default since the Turbo Pascal days when we only had 80 columns to work with. Seeing a file formatted with four spaces after all these years just seems wasteful. My code uses has increased the use of shorter functions over the years so running off the screen is not as much of a problem as it was when I started.

                                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
                                  Rich Shealer
                                  wrote on last edited by
                                  #36

                                  I don't the understand the hate for #3. From the other comments I appear to be in the minority. Mostly because it saves vertical space and still provides a well defined block for the conditional statement.

                                  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
                                    maze3
                                    wrote on last edited by
                                    #37

                                    not following pre existing conventions of code you were given to make a fix for

                                    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.

                                      B Offline
                                      B Offline
                                      BryanFazekas
                                      wrote on last edited by
                                      #38

                                      MarkTJohnson wrote:

                                      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.

                                      Dumb decisions pretty much defines JavaScript. The only thing I can think of that JavaScript missed is use of indents to define blocks as in Python.

                                      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
                                        MikeTheFid
                                        wrote on last edited by
                                        #39

                                        It really annoys me when people don't respect the coding style they encounter while changing someone else's code. It's even worse when they run a reformatter that changes the entire file to their preferred style. I think a bunch of the style quirks like #3 came from a time where the number of lines in the file made navigation arduous. I'm looking at you ed.

                                        Cheers, Mike Fidler "I intend to live forever - so far, so good." Steven Wright "I almost had a psychic girlfriend but she left me before we met." Also Steven Wright "I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.

                                        D 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.

                                          O Offline
                                          O Offline
                                          obermd
                                          wrote on last edited by
                                          #40

                                          First example would have different meanings in most languages because they aren't white space significant. The rest are just preferences and I set my IDE to allow me to quickly reformat the code to my preference.

                                          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