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. Sloppy Code - thoughts

Sloppy Code - thoughts

Scheduled Pinned Locked Moved The Lounge
questiondiscussion
55 Posts 32 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.
  • J Jeremy Falcon

    While we're on the subject of code reviews, what do you guys think about sloppy code that's not formatted well? I tend to not think I'm that anal retentive, but I admit the poindexter comes out when I see sloppy code that's not kept up to a proper margin, not indented decently, old commented code left in, etc. Oddly enough, the coders that write messy code tend to also have messy cars and homes. It's gross.

    Jeremy Falcon

    G Offline
    G Offline
    Grav Vt
    wrote on last edited by
    #41

    Sloppy code; which to me is any code with bad formatting, no documentation ("my code is self-documenting" == garbage is to be left alone, not documented) and one-letter variable names (how are you saving typing time when autocomplete exists), this type of code has parallels with other services: the contractor who builds a house with crooked studs, uneven walls and leaking water lines or a mechanic who installs used parts as "new" and then leaves engine stains all over the interior of the car. In each case, the work was performed by a hack with no pride in the craft; someone who should be run out of the industry. With development specifically, I assume such code to have been written by "drag-and-drop" experts who complain that "coding is hard" and celebrate any framework that keeps them from being forced to learn how to code at a lower-level (MEANING: loves to drag-and-drop DB connection controls but could not write simple ADO.Net access code). Short answer: get out of the industry or join a bro-grammer collective to hide in.

    1 Reply Last reply
    0
    • M milo xml

      I doubt Einstein ever showed up for a job interview looking like that, especially in his younger years. Once you've established yourself you can pull off the disheveled look :) (Found a pic [^])

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #42

      Very interesting link... Thanks!

      If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
      You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

      1 Reply Last reply
      0
      • J Jeremy Falcon

        While we're on the subject of code reviews, what do you guys think about sloppy code that's not formatted well? I tend to not think I'm that anal retentive, but I admit the poindexter comes out when I see sloppy code that's not kept up to a proper margin, not indented decently, old commented code left in, etc. Oddly enough, the coders that write messy code tend to also have messy cars and homes. It's gross.

        Jeremy Falcon

        S Offline
        S Offline
        StatementTerminator
        wrote on last edited by
        #43

        Readability and maintainability are at least as important as working code. Sloppy formatting costs time and money, and can lead to bugs. I don't even want to think about how much time I've had to spend re-formatting someone else's code to the point where I can read and fix it.

        1 Reply Last reply
        0
        • S Simon_Whale

          No I can deal with Hungarian notation as It was something that was considered good practice when I started with coding. An example of what I meant about silly naming convetions was..

          private ClientPropertyForm m_RW_CPForm = null;

          it took me a while to see that this was a supposed to be a read write instance of the client property form.

          Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

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

          that's pretty gnarly, I agree. Another pet peeve I have - arbitrary abbreviations in a variable name. So, in your example: m_RW_ClientPropertyForm becomes m_RW_ClntPrpFrm.

          Charlie Gilley Stuck in a dysfunctional matrix from which I must escape... "Where liberty dwells, there is my country." B. Franklin, 1783 “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759

          1 Reply Last reply
          0
          • L Le Page

            That's kind of a shallow analogy. It's like comparing Tesla's love for physics and women. You just cannot seek connections between ones physical appearance and mental capabilities.

            R Offline
            R Offline
            richard_k
            wrote on last edited by
            #45

            Errr.. no. For years the military has used attention to excruciating detail in training to get soldiers aware of small things.. since ignoring small things can get you killed in combat. The attitude you bring to the table regarding how you handle details shows up in ALL we do. And good software is definitely about managing details well. I couldn't disagree with you more.

            1 Reply Last reply
            0
            • R R Giskard Reventlov

              About what?

              J Offline
              J Offline
              jibalt
              wrote on last edited by
              #46

              You're certainly no Einstein if you can't figure it out ... but that was already obvious.

              R 1 Reply Last reply
              0
              • J jibalt

                You're certainly no Einstein if you can't figure it out ... but that was already obvious.

                R Offline
                R Offline
                R Giskard Reventlov
                wrote on last edited by
                #47

                Probably. :(

                1 Reply Last reply
                0
                • J Jeremy Falcon

                  While we're on the subject of code reviews, what do you guys think about sloppy code that's not formatted well? I tend to not think I'm that anal retentive, but I admit the poindexter comes out when I see sloppy code that's not kept up to a proper margin, not indented decently, old commented code left in, etc. Oddly enough, the coders that write messy code tend to also have messy cars and homes. It's gross.

                  Jeremy Falcon

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

                  Jeremy Falcon wrote:

                  what do you guys think about sloppy code that's not formatted well?

                  I don't think much of it.  IMHO code should be formatted so that its intent is clear.  While I prefer the K&R style, I'm not picky as long as the style is readable. /ravi

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

                  1 Reply Last reply
                  0
                  • R R Giskard Reventlov

                    However awful my code might be, at least it's properly formatted... :-) I agree with you; it's the same when I interview a developer that turns up looking like a homeless person: if you can't be bothered to take care of yourself, why would I believe that you'd be any different with your attitude to coding?

                    J Offline
                    J Offline
                    JesperMadsen123
                    wrote on last edited by
                    #49

                    Use a tool for codeformatting, make sure to run it before you commit your code, or make your editor format your code. Codeformatting "by hand" is waste and should be eliminated.

                    R 1 Reply Last reply
                    0
                    • J JesperMadsen123

                      Use a tool for codeformatting, make sure to run it before you commit your code, or make your editor format your code. Codeformatting "by hand" is waste and should be eliminated.

                      R Offline
                      R Offline
                      R Giskard Reventlov
                      wrote on last edited by
                      #50

                      I do that to other people's code. :-)

                      A 1 Reply Last reply
                      0
                      • R R Giskard Reventlov

                        I do that to other people's code. :-)

                        A Offline
                        A Offline
                        Adam Tibi
                        wrote on last edited by
                        #51

                        When you do that: - It seems in the source control that you modified the source code - It looks insulting for the other developer (the one who originally wrote the code) If you can't agree in a friendly conversation on one style of code, then you have more important problems to tackle in the team.

                        Make it simple, as simple as possible, but not simpler.

                        R 1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          It's so easy to format your code properly... Ctrl + K, Ctrl + D (in Visual Studio anyway). It doesn't delete white spaces, but it does quite a bit for you. I'm amazed at how much badly formatted code I still see! And in my experience if the code is poorly formatted it's poorly written. Comments are as bad, or worse...

                          // Create a new person
                          Person p = new Person();

                          NO, REALLY!? Arghhh! And I actually see those kinds of comments... Another thing I can't stand is copy-paste programming. And much too often it's way too obvious. The following is some production code I've had the 'pleasure' of working with (it was an obvious comment that was copy-pasted, but not edited with the code).

                          // Save the customer
                          product.Save();

                          I looked at it and screamed in disgust "OH LORD, WHY DO YOU HATE ME SO!? :(( "

                          My blog[^]

                          public class SanderRossel : Lazy<Person>
                          {
                          public void DoWork()
                          {
                          throw new NotSupportedException();
                          }
                          }

                          A Offline
                          A Offline
                          Adam Tibi
                          wrote on last edited by
                          #52

                          I always jokingly tease the developer who added the comment.

                          Make it simple, as simple as possible, but not simpler.

                          1 Reply Last reply
                          0
                          • A Adam Tibi

                            When you do that: - It seems in the source control that you modified the source code - It looks insulting for the other developer (the one who originally wrote the code) If you can't agree in a friendly conversation on one style of code, then you have more important problems to tackle in the team.

                            Make it simple, as simple as possible, but not simpler.

                            R Offline
                            R Offline
                            R Giskard Reventlov
                            wrote on last edited by
                            #53

                            Adam Tibi wrote:

                            It seems in the source control that you modified the source code

                            Indeed.

                            Adam Tibi wrote:

                            It looks insulting for the other developer (the one who originally wrote the code)

                            Then they should have done it right the first time. Seriously, if you're insulted because I tell you to format the code according to our agreed upon standards, then you're working in the wrong place.

                            1 Reply Last reply
                            0
                            • J Jeremy Falcon

                              While we're on the subject of code reviews, what do you guys think about sloppy code that's not formatted well? I tend to not think I'm that anal retentive, but I admit the poindexter comes out when I see sloppy code that's not kept up to a proper margin, not indented decently, old commented code left in, etc. Oddly enough, the coders that write messy code tend to also have messy cars and homes. It's gross.

                              Jeremy Falcon

                              T Offline
                              T Offline
                              TNCaver
                              wrote on last edited by
                              #54

                              Have you ever seen pictures of Einstein's office?

                              If you think 'goto' is evil, try writing an Assembly program without JMP.

                              J 1 Reply Last reply
                              0
                              • T TNCaver

                                Have you ever seen pictures of Einstein's office?

                                If you think 'goto' is evil, try writing an Assembly program without JMP.

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

                                Touché!

                                Jeremy Falcon

                                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