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 - so what's a crime and whats a misdemeanor?

Coding - so what's a crime and whats a misdemeanor?

Scheduled Pinned Locked Moved The Lounge
databasecombeta-testingquestion
108 Posts 38 Posters 113 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.
  • D Duncan Edwards Jones

    Misdemeanour: CVDD (Curriculum Vitae driven development) - implementing a technology or architecture just to say you did. (This isn't always a crime though - sometimes it helps shake the slurry out of the system)

    R Offline
    R Offline
    Rob Philpott
    wrote on last edited by
    #37

    Duncan Edwards Jones wrote:

    CVDD (Curriculum Vitae driven development) - implementing a technology or architecture just to say you did.

    I like that! Committed to vocabulary.

    Regards, Rob Philpott.

    1 Reply Last reply
    0
    • Richard DeemingR Richard Deeming

      D.1) Storing "numbers" as integers just because they're called numbers. (Telephone numbers, social security numbers, etc.)


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

      +24

      1 Reply Last reply
      0
      • L Lost User

        Committing commented-out code. I'm not sure whether it's a misdemeanor or crime though.

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

        harold aptroot wrote:

        Committing commented-out code

        We don't do this in our shop - a big no-no. That is what Source control is for.

        1 Reply Last reply
        0
        • Z ZurdoDev

          Eddy Vluggen wrote:

          I detest the "Goto error, goto exit"-pattern from VB.

          I wonder where this hatred has come from. I did plenty of programming in VB6 and GOTO was a go to statement. It seems like some of y'all lose sleep over thinking about GOTO. Let it go. :-\

          There are only 10 types of people in the world, those who understand binary and those who don't.

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

          In the context of VB, I agree. GOTO was/is there for a reason.

          1 Reply Last reply
          0
          • M Matt L

            Any code that has implemented some sort of source control shouldn't have any commented code. If your customer wanted to go back to previous functionality, you should review the source code history to retrieve it from there, it should even be wrapped up in a single check-in with all the dependencies that the functionality relies on. You can comment code during development to test other avenues, in fact, I think can use whatever coding practice you like while developing :-\ but it shouldn't get committed into the code base. Sorry if this comes across a bit sour, but I'm working at a place that used to use commented code as source control... They have source control now, but they haven't grasped the concept very well and the code is littered with obsolete, misleading and blatantly wrong comments :wtf: :mad: So... crime.

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

            :thumbsup:

            Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

            1 Reply Last reply
            0
            • L Lost User

              OriginalGriff wrote:

              Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile.

              Crimes Starting Alphabetically 'numbered' lists

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

              Normally, I wouldn't - but I didn't want to influence people into the "zero- or one- based lists" argument with both being crimes, probably...

              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

              1 Reply Last reply
              0
              • Z ZurdoDev

                Having multiple return statements in a single function. :thumbsdown:

                There are only 10 types of people in the world, those who understand binary and those who don't.

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

                I'd disagree with this: I'd far rather see validation failures causing an immediate return then over indented cr@p to avoid it:

                int age;
                if (!int.TryParse(tbAge.Text, out age) && age > 0 && age < 150)
                {
                MessageBox.Show("Age must be an integral value between 1 and 150");
                return;
                }
                ...

                int age;
                if (!int.TryParse(tbAge.Text, out age) && age > 0 && age < 150)
                {
                MessageBox.Show("Age must be an integral value between 1 and 150");
                }
                else
                {
                ...

                You can get away with that for one level, but when you are validating a dozen inputs? Return is a cleaner way to do it, IMO.

                Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

                Z R 2 Replies Last reply
                0
                • Richard DeemingR Richard Deeming

                  Using a script to prevent users from pasting passwords into your login form, and then claiming it's for their own good. :doh: It's not about "supporting password managers", it's about not consciously breaking security | Troy Hunt[^]


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

                  Yeah...that winds me up. Particularly when they have to put effort into making it harder to use different passwords for every system. :mad:

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

                  J 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    I'd disagree with this: I'd far rather see validation failures causing an immediate return then over indented cr@p to avoid it:

                    int age;
                    if (!int.TryParse(tbAge.Text, out age) && age > 0 && age < 150)
                    {
                    MessageBox.Show("Age must be an integral value between 1 and 150");
                    return;
                    }
                    ...

                    int age;
                    if (!int.TryParse(tbAge.Text, out age) && age > 0 && age < 150)
                    {
                    MessageBox.Show("Age must be an integral value between 1 and 150");
                    }
                    else
                    {
                    ...

                    You can get away with that for one level, but when you are validating a dozen inputs? Return is a cleaner way to do it, IMO.

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                    Z Offline
                    Z Offline
                    ZurdoDev
                    wrote on last edited by
                    #45

                    I know it's just one example, but in this case my validation code is going into it's own method.

                    There are only 10 types of people in the world, those who understand binary and those who don't.

                    OriginalGriffO 1 Reply Last reply
                    0
                    • Z ZurdoDev

                      I know it's just one example, but in this case my validation code is going into it's own method.

                      There are only 10 types of people in the world, those who understand binary and those who don't.

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

                      But then you have the same problem within the validation method. :laugh:

                      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

                      Z 2 Replies Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        But then you have the same problem within the validation method. :laugh:

                        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                        Z Offline
                        Z Offline
                        ZurdoDev
                        wrote on last edited by
                        #47

                        If it gets long, sure. But it aint hard to do right.

                        There are only 10 types of people in the world, those who understand binary and those who don't.

                        1 Reply Last reply
                        0
                        • OriginalGriffO OriginalGriff

                          But then you have the same problem within the validation method. :laugh:

                          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                          Z Offline
                          Z Offline
                          ZurdoDev
                          wrote on last edited by
                          #48

                          Plus, most people want to see all validation errors at once so you would want to do the whole method anyway. :^)

                          There are only 10 types of people in the world, those who understand binary and those who don't.

                          L 1 Reply Last reply
                          0
                          • Z ZurdoDev

                            Plus, most people want to see all validation errors at once so you would want to do the whole method anyway. :^)

                            There are only 10 types of people in the world, those who understand binary and those who don't.

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

                            ..sounds like a large method with multiple responsibilities. How about a class that simply checks one thing; and call that in a loop, adding to a resultset?

                            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                            Z 1 Reply Last reply
                            0
                            • L Lost User

                              ..sounds like a large method with multiple responsibilities. How about a class that simply checks one thing; and call that in a loop, adding to a resultset?

                              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                              Z Offline
                              Z Offline
                              ZurdoDev
                              wrote on last edited by
                              #50

                              Eddy Vluggen wrote:

                              How about a class that simply checks one thing; and call that in a loop, adding to a resultset?

                              How about we never work on the same code so there will be no problems. ;)

                              There are only 10 types of people in the world, those who understand binary and those who don't.

                              L 1 Reply Last reply
                              0
                              • L Lost User

                                So, when do you use Systems Hungarian? Or worse, Apps Hungarian? :)

                                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                G Offline
                                G Offline
                                glennPattonWork3
                                wrote on last edited by
                                #51

                                Shouldn't you ask Nagy?:~

                                L 1 Reply Last reply
                                0
                                • Z ZurdoDev

                                  Eddy Vluggen wrote:

                                  How about a class that simply checks one thing; and call that in a loop, adding to a resultset?

                                  How about we never work on the same code so there will be no problems. ;)

                                  There are only 10 types of people in the world, those who understand binary and those who don't.

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

                                  RyanDev wrote:

                                  How about we never work on the same code so there will be no problems. ;)

                                  :laugh:

                                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                  1 Reply Last reply
                                  0
                                  • G glennPattonWork3

                                    Shouldn't you ask Nagy?:~

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

                                    I'm not going to ask Nagy anything, he might still be upset about the goulasj :)

                                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                    1 Reply Last reply
                                    0
                                    • J Jorgen Andersson

                                      D) Use GOTO. E) Systems Hungarian But I'd like to add, that you also need to know when to break the rules.

                                      Wrong is evil and must be defeated. - Jeff Ello

                                      E Offline
                                      E Offline
                                      Erik Burd
                                      wrote on last edited by
                                      #54

                                      I've used GOTO in driver development when it made sense. Generally speaking I don't use it but when it's needed there's nothing wrong with it.

                                      "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." -- Marcus Brigstocke, British Comedian

                                      1 Reply Last reply
                                      0
                                      • OriginalGriffO OriginalGriff

                                        Yeah...that winds me up. Particularly when they have to put effort into making it harder to use different passwords for every system. :mad:

                                        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                                        J Offline
                                        J Offline
                                        Jorgen Andersson
                                        wrote on last edited by
                                        #55

                                        I'm waiting for the first bank to implement Facebook single sign on.

                                        Wrong is evil and must be defeated. - Jeff Ello

                                        1 Reply Last reply
                                        0
                                        • OriginalGriffO OriginalGriff

                                          Was just adding something in QA and I thought: there are things no sentient coder should do these days, but every day in QA we see some halfwit doing them. So I figure we need a list of Crimes and Misdemeanors, and these are my first candidates. Misdemeanors are "smack on the head" offenses, Crimes deserve a death sentence! :laugh: Misdemeanors: A) Ignoring existing standards and modifying someone else's code "your way". Crimes: A) Storing passwords in plain text: CommitStrip[^] B) Leaving your code open to SQL Injection: XKCD[^] C) Committing code that doesn't compile. Anyone want to add to these?

                                          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

                                          Misdemeanor: Mixing tabs and spaces. Pick one or the other. Not using a Linting tool. Crime: In addition to not checking user input, not validating parameter input for a routine. Not checking for Null. Having two routines do the the same thing.

                                          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