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.
  • C charlieg

    "silly naming conventions" like absurd Hungarian notation? There are only two variable naming conventions I prefer - the first is putting a "p" in front of a pointer: int *pInt; I know that's simple, but to just have it so obvious makes it easier for me to understand. The second is adding lsbs to the variable name: "crankshaft_diameter_mm" but I'm losing my love for this. I do work in the embedded world, and all is wonderful as long as the next product version does not roll out. I'm dealing with this now - common code base, version one had 1mm lsb, next version is .1 mm. Sort of elephants the variable names.

    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

    S Offline
    S Offline
    Simon_Whale
    wrote on last edited by
    #30

    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 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?

      L Offline
      L Offline
      Le Page
      wrote on last edited by
      #31

      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.

      A R R 3 Replies 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

        K Offline
        K Offline
        Kirk Wood
        wrote on last edited by
        #32

        Two things that really annoy me are sloppy formatting and leaving old commented code. One, formatting is just so easy in a number of environments. And two, if you need the old code, that is what the source control is for. Makes me wonder if a person bothers taking out the trash at home.

        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

          C Offline
          C Offline
          cramotowski
          wrote on last edited by
          #33

          It bothers me a great deal and for very specific reasons. When working in a team, it is not good enough to clean up someone else's code by running an auto format tool. Depending on the tabs vs spaces issue this can potentially be a far from trivial task. Additionally, if you do just clean up every file in a project before you commit your changes, you may be horribly polluting the commit history and your diff will give no one on your team any clue as to what you actually implemented. It's a dangerous game that will compound over time. Best is to review code as a group and set up all of your editors to be consistent. Then define a standard art form that you all agree on. Anything less than that and you're asking for a world of hurt.

          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

            C Offline
            C Offline
            coding4ever
            wrote on last edited by
            #34

            I agree that it irks me when you go to look at someones code and the indenting and spacing is all off (or worse, mix CamelCase and snake_case). I'm a stickler for making sure everything in my code is formatted nicely so it's readable. However I do have 3 kids so the "formatting" of my house and car on the other hand......

            1 Reply Last reply
            0
            • K Kenneth Haugland

              I think the comments about the looks on one subject also reflects the action in another. If it truly were like that you'd never be fooled, by, let's say, politicians. ;)

              M Offline
              M Offline
              milo xml
              wrote on last edited by
              #35

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

                A Offline
                A Offline
                agolddog
                wrote on last edited by
                #36

                Years of research have shown that I can develop software just as well in jeans and tennis shoes as compared to slacks and dress shoes.

                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
                  R Giskard Reventlov
                  wrote on last edited by
                  #37

                  It was, of course, somewhat of a generalization - my wife tells me I look like a tramp on the days I can't be asked to shave. :)

                  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

                    K Offline
                    K Offline
                    Kirk 10389821
                    wrote on last edited by
                    #38

                    I think it is a sign. There is a sayings I like: How you do anything is how you do everything! But there is a timing facet to it as well. I am guilty of being a little sloppy, and commenting out code. While I am working on it. Clearing my thoughts. And my office gets messy. But as I wrap up, I truly enjoy going back over the code and cleaning it up. Of course, this is NOT about indentation, I lost the ability to work with code that is not indented properly. But while I am working, I admit that my equal signs in block assignments are not always aligned. My EOL comments don't start on the same column. And that I have commented out code just dying to be removed. That's what makes code reviews great. I have 2 reasons to clean it all up when my confidence in the code quality is high. First, for personal reasons. Second, because getting called out for that stuff in public is not "pleasant", especially when you are the boss...

                    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

                      _ Offline
                      _ Offline
                      _WinBase_
                      wrote on last edited by
                      #39

                      I suppose i'm super anal when it comes to code layout. Only myself see's my own code but everything is properly commented, indented, and I use the correct PascalCase or camelCase variable naming, and try to stick to as many good practices as possible - I just like looking at 'nice' code lol and doesn't really take any longer to do it right rather than wrong.

                      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

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

                        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
                        • 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

                          C Offline
                          C Offline
                          Clint Helton
                          wrote on last edited by
                          #41

                          All my company cares about is delivering on-time and on-budget. Although lip service is paid to quality, those that attempt to do a good job (including writing robust and maintainable code) cannot hope to even come close to meeting schedule.

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