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.
  • K Kevin Bewley

    I often get accused of commenting the obvious but I was taught to, and still do for complex algorithms/methods write what I want to do in terms of words as a comment (my intended function). Then I write the code underneath. The comments were there before the code, so it'd take me more time to delete them. Sorry - if you find it hard to just scroll past that stuff...

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

    What people forget is that each comment is a line of code that has to be as carefully written as everything else and that if the code changes so should the comments. In the end, if there's lots of bad comments, people learn to ignore comments and miss the actual good comments! I've actually written a tip about it, Write comments that matter[^], because I see so many comments that add absolutely nothing to the code. I haven't seen your code, so I don't know if you do any of the stuff I describe in the tip, but if you do I ask you, for the sake of programmers everywhere, please reconsider this bad habit of yours! :laugh:

    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

    Regards, Sander

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

      B Offline
      B Offline
      Brady Kelly
      wrote on last edited by
      #82

      Unsorted pick lists and dropdowns. This kind of thing is easy enough for even a blank slate intern to get right.

      Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley

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

        E Offline
        E Offline
        englebart
        wrote on last edited by
        #83

        incorrect indentation combined with single statement control flow (no braces) Java/C/C#/C++

        if (condition)

        // 10 line lengthy explanation
        //

        originalSingleStatementForIf;
        futureStatementThatNeedsToExecuteInAddtionTo_originalSingleStatementForIf;

        FIX: Always use braces!

        if (condition) {

        // 10 line lengthy explanation
        //

        originalSingleStatementForIf;
        futureStatementThatNeedsToExecuteInAddtionTo_originalSingleStatementForIf;
        }

        1 Reply Last reply
        0
        • G Gary Wheeler

          Then it sounds like the process is organized poorly. If a separate process will "fix it anyway", then why does the original stored procedure need to be done at all? For that matter, if you've got processes that fix problems in earlier steps, then you've got a system built out of Band-Aid™s.

          Software Zen: delete this;

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

          Gary Wheeler wrote:

          then you've got a system built out of Band-Aid™s.

          No, it's called dealing with 3rd party tools. :-\

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

          G 1 Reply Last reply
          0
          • Z ZurdoDev

            Gary Wheeler wrote:

            then you've got a system built out of Band-Aid™s.

            No, it's called dealing with 3rd party tools. :-\

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

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

            You have my sympathy. I hate dealing with third-party tools in our products. As the DSJB(*) I get to write our installers. I have one product that requires not one but two different versions of the Visual C++ runtime because of third-party dependencies. (*) Departmental Sh!t-Job Boy

            Software Zen: delete this;

            Z 1 Reply Last reply
            0
            • G Gary Wheeler

              You have my sympathy. I hate dealing with third-party tools in our products. As the DSJB(*) I get to write our installers. I have one product that requires not one but two different versions of the Visual C++ runtime because of third-party dependencies. (*) Departmental Sh!t-Job Boy

              Software Zen: delete this;

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

              Gary Wheeler wrote:

              not one but two different versions of the Visual C++ runtime because of third-party dependencies.

              :thumbsdown:

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

              1 Reply Last reply
              0
              • PJ ArendsP PJ Arends

                Indentation with tabs: Crime. Sometimes I will read code in Notepad, and there the tab spacing is just too large.

                Within you lies the power for good - Use it!

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

                PJ Arends wrote:

                Sometimes I will read code in Notepad,

                Not just a crime, but also an obscenity. You can't blame tabs for an editor knocked together one afternoon after a liquid lunch in 1985.

                Regards, Rob Philpott.

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

                  A Offline
                  A Offline
                  alfyvr
                  wrote on last edited by
                  #88

                  Regarding A, I hate to say that sometimes you are left with no choice. It is part of the unavoidable friction that ensues when someone would not listen to reasons, not even in front of overwhelming evidence.

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

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #89
                    1. Using camelCase when not using Hungarian. 1) Using Hungarian.
                    1 Reply Last reply
                    0
                    • B Brady Kelly

                      Unsorted pick lists and dropdowns. This kind of thing is easy enough for even a blank slate intern to get right.

                      Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #90

                      DropDowns with more than a dozen items or only two items. DropDowns for numbers. Three DropDowns instead of a single DateTimePicker.

                      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)

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #91

                        No, Apps Hungarian is the better of the two. But not by much. http://www.joelonsoftware.com/articles/Wrong.html[^]

                        L 1 Reply 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

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #92

                          Those are not gotos. Aside: While simplifying some code this week I removed a switch (that was inside a while) ... and later realized that I hadn't removed a break that was left over. :doh: I really dislike that break operates on switch -- I hope DMR's harp gives him blisters.

                          G 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            No, Apps Hungarian is the better of the two. But not by much. http://www.joelonsoftware.com/articles/Wrong.html[^]

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

                            That is Joels' take. I rather not see prefixes at all. I can imagine the type, if you're reading from a printout and taking a ... walk, but not "Apps", where different abs got different meanings for each product.

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

                            P 1 Reply Last reply
                            0
                            • L Lost User

                              That is Joels' take. I rather not see prefixes at all. I can imagine the type, if you're reading from a printout and taking a ... walk, but not "Apps", where different abs got different meanings for each product.

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

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #94

                              Eddy Vluggen wrote:

                              where different abs got different meanings for each product.

                              That's the whole point.

                              1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                Those are not gotos. Aside: While simplifying some code this week I removed a switch (that was inside a while) ... and later realized that I hadn't removed a break that was left over. :doh: I really dislike that break operates on switch -- I hope DMR's harp gives him blisters.

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

                                True - back when I was at university in the late 80's we were taught 'structured programming' and anything that threw you out of an iteration was forbidden, until year two when we were told that there were circumstances where there was not other option.

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

                                ― Christopher Hitchens

                                P 1 Reply Last reply
                                0
                                • G GuyThiebaut

                                  True - back when I was at university in the late 80's we were taught 'structured programming' and anything that threw you out of an iteration was forbidden, until year two when we were told that there were circumstances where there was not other option.

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

                                  ― Christopher Hitchens

                                  P Offline
                                  P Offline
                                  PIEBALDconsult
                                  wrote on last edited by
                                  #96

                                  GuyThiebaut wrote:

                                  anything that threw you out of an iteration was forbidden

                                  But break goes only to the end, not somewhere completely different, it's structured (still prefer to avoid it though).

                                  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

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #97

                                    Hear! Hear!

                                    1 Reply Last reply
                                    0
                                    • K Kevin McFarlane

                                      It will be in the source code history.

                                      Kevin

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #98

                                      But where? And why was it removed?

                                      1 Reply Last reply
                                      0
                                      • S Simon_Whale

                                        Code that is complex by how its written rather than by it complexity of the problem

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

                                        D Offline
                                        D Offline
                                        Dar Brett 0
                                        wrote on last edited by
                                        #99

                                        Reminds me of my tech leads description of my code... I still think that it's necessary to write some code using reflection to generate a JavaScript file to be added dynamically during application startup to a web optimization bundle to declare AngularJS references to some Web API Controllers so that I can save myself ten minutes of copy-pasting every few weeks when I need a new Controller.

                                        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
                                          Dar Brett 0
                                          wrote on last edited by
                                          #100

                                          Some crimes I've seen in the last few years: A) Introducing dependencies without checking to see if they're reliable. B) Introducing dependencies that are just a C# wrapper around a REST API. C) Deciding that automating builds/deployments isn't worth the time. D) Manually deploying changes to production without committing them to source control (after which of course you go on leave). F) Being a lead developer and insisting that all columns in a database be nullable. G) Giving full sa/admin/root permissions to someone/something because you don't know what permissions it actually needs - have to confess I've been guilty of this in the past. H) Using {PopularFramework}.js because it's popular I can't seem to think of any misdemeanours though.

                                          R 2 Replies 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