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.
  • L Lost User

    Concatenating constant-strings. Swallowing exceptions. Throwing ex; P/Invokes copied from the web when there's a managed alternative. ..would become a long list.

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

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

    Eddy Vluggen wrote:

    Swallowing exceptions.

    :mad::mad::mad: Dealt with that not too long ago, .......wanted.....to....kill......

    "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

    1 Reply Last reply
    0
    • L Lost User

      Concatenating constant-strings. Swallowing exceptions. Throwing ex; P/Invokes copied from the web when there's a managed alternative. ..would become a long list.

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

      Eddy Vluggen wrote:

      Swallowing exceptions.

      Some exceptions are OK to ignore. :^)

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

      L R 2 Replies Last reply
      0
      • N Nelek

        GOTO can be useful and there are moments where it is needed. Misusing it can result in spagetti code I know but... I would like to see you coding in LAP (PLC) or assembly without JMP instructions...

        M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

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

        That's why I added the second sentence.

        Wrong is evil and must be defeated. - Jeff Ello

        N 1 Reply Last reply
        0
        • L Lost User

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

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

          harold aptroot wrote:

          Committing commented-out code.

          That's called good practice. :-\ Actually, there have been times when business requirements went back to what they were before and so uncommenting the code was quite simple. I don't leave commented code in forever though. After a certain amount of time passes, it can go.

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

          D M K 3 Replies 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...

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

            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.

            L OriginalGriffO K 3 Replies Last reply
            0
            • G GuyThiebaut

              Jörgen Andersson wrote:

              D) Use GOTO.

              so break and return are not to be used?

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

              ― Christopher Hitchens

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

              They all become jumps in the end. Breaks, returns and exits have a quite lower probability of becoming pasta.

              Wrong is evil and must be defeated. - Jeff Ello

              1 Reply Last reply
              0
              • P phil o

                D) Storing numbers and datetimes as string in database / counfounding a value with its string representation. E) Not reading the documentation of the objets used in the application. F) Not checking/validating user inputs. G) Copy-pasting a code from anywhere on Internet and expecting it to work without having to think about the requirement ; asking someone else to solve the problem when copied code does not behave the exact desired way (without defining the correct behaviour whatsoever).

                I never finish anyth

                Richard DeemingR Offline
                Richard DeemingR Offline
                Richard Deeming
                wrote on last edited by
                #21

                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

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

                P S P 3 Replies 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

                  P Offline
                  P Offline
                  phil o
                  wrote on last edited by
                  #22

                  So true :)

                  I never finish anyth

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

                    Richard DeemingR Offline
                    Richard DeemingR Offline
                    Richard Deeming
                    wrote on last edited by
                    #23

                    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

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

                    OriginalGriffO 1 Reply Last reply
                    0
                    • Z ZurdoDev

                      Eddy Vluggen wrote:

                      Swallowing exceptions.

                      Some exceptions are OK to ignore. :^)

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

                      Yes, I heard that often :rolleyes:

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

                      Z M W 3 Replies Last reply
                      0
                      • L Lost User

                        Yes, I heard that often :rolleyes:

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

                        Eddy Vluggen wrote:

                        I heard that often :rolleyes:

                        What about when you are in the middle of a long process of sql things and then you call one SP that sets a value but is not critical to anything else. If it fails, it's OK because a separate process later on will fix it anyway. What do you do then with the exception?

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

                        L G 2 Replies Last reply
                        0
                        • Z ZurdoDev

                          harold aptroot wrote:

                          Committing commented-out code.

                          That's called good practice. :-\ Actually, there have been times when business requirements went back to what they were before and so uncommenting the code was quite simple. I don't leave commented code in forever though. After a certain amount of time passes, it can go.

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

                          D Offline
                          D Offline
                          Duncan Edwards Jones
                          wrote on last edited by
                          #26

                          One of the biggest dangers in software development is when code gets into the code base without first going through the human brain. Un-commenting a block that looks like it shouldn't be commented out is a classic way that this occurs.

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

                            F Offline
                            F Offline
                            F ES Sitecore
                            wrote on last edited by
                            #27

                            If we're talking QA Misdemeanour * expecting someone to be able to solve your null reference problem * doesn't work * sending email through gmail * I get an error (no I'm not telling you what it is) * any kind of casting problem * ToString() on a string * attempting to code in MVC without understanding HTTP * thinking that setting the MIME type of your response to "application/vnd.ms-excel" is "creating an Excel spread sheet" Crime * posting 100 lines of code and expecting someone to be able to solve your null reference problem without even saying what line it happens on * when sending email getting a perfectly understandable error like "Authentication failed" and asking for the code to fix it * any kind of casting problem where you expect a stranger to understand what you mean and not what you say * any question that is effectively "how do I write a website" * any question regarding the generation of PDF files * any question regarding the generation of Excel files * any question regarding the generation of Word files * asking how to store dates in SQL in a given format

                            1 Reply Last reply
                            0
                            • D Duncan Edwards Jones

                              One of the biggest dangers in software development is when code gets into the code base without first going through the human brain. Un-commenting a block that looks like it shouldn't be commented out is a classic way that this occurs.

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

                              Duncan Edwards Jones wrote:

                              Un-commenting a block that looks like it shouldn't be commented out is a classic way that this occurs.

                              Never heard of someone doing that. If you thought that was what I was suggesting, you misread.

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

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

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

                                Now there's an old idea that is hard to defend; yes, I agree, you have to know when to break the rules. I'd rather see a return from a switch then someone using goto's simply to have a single exit-point. I detest the "Goto error, goto exit"-pattern from VB.

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

                                  D Offline
                                  D Offline
                                  Duncan Edwards Jones
                                  wrote on last edited by
                                  #30

                                  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 1 Reply Last reply
                                  0
                                  • Z ZurdoDev

                                    Duncan Edwards Jones wrote:

                                    Un-commenting a block that looks like it shouldn't be commented out is a classic way that this occurs.

                                    Never heard of someone doing that. If you thought that was what I was suggesting, you misread.

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

                                    D Offline
                                    D Offline
                                    Duncan Edwards Jones
                                    wrote on last edited by
                                    #31

                                    No - I'm suggesting it can happen if code is commented out and then the result checked into source control....

                                    1 Reply Last reply
                                    0
                                    • Z ZurdoDev

                                      Eddy Vluggen wrote:

                                      I heard that often :rolleyes:

                                      What about when you are in the middle of a long process of sql things and then you call one SP that sets a value but is not critical to anything else. If it fails, it's OK because a separate process later on will fix it anyway. What do you do then with the exception?

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

                                      I log it; I want to know *why* it failed and why I did not consider it as a possible path. Hence the term "unexpected" - there's also some exceptions that *are* expected :)

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

                                        harold aptroot wrote:

                                        Committing commented-out code.

                                        That's called good practice. :-\ Actually, there have been times when business requirements went back to what they were before and so uncommenting the code was quite simple. I don't leave commented code in forever though. After a certain amount of time passes, it can go.

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

                                        M Offline
                                        M Offline
                                        Matt L
                                        wrote on last edited by
                                        #33

                                        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 C 2 Replies Last reply
                                        0
                                        • L Lost User

                                          Now there's an old idea that is hard to defend; yes, I agree, you have to know when to break the rules. I'd rather see a return from a switch then someone using goto's simply to have a single exit-point. I detest the "Goto error, goto exit"-pattern from VB.

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

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