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. Other Discussions
  3. The Weird and The Wonderful
  4. One of those bad days and now i find stuff like this...

One of those bad days and now i find stuff like this...

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
17 Posts 13 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.
  • B Bigdeak

    if (doc.status==3)
    {
    // With this Status, nothing should be done here.
    }
    else if (doc.status == 2 || doc.status == 1)
    {
    AddDoc(doc);
    }

    Finish();

    Should i laugh or cry?

    J Offline
    J Offline
    Jeroen De Dauw
    wrote on last edited by
    #3

    What?! He's not throwing an exception when doc.status > 9000! Lame code is lame.

    Jeroen De Dauw
    Blog ; Wiki

    1 Reply Last reply
    0
    • B Bigdeak

      if (doc.status==3)
      {
      // With this Status, nothing should be done here.
      }
      else if (doc.status == 2 || doc.status == 1)
      {
      AddDoc(doc);
      }

      Finish();

      Should i laugh or cry?

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #4

      Maybe that first if statement was included for the purpose of pseudo-documentation. For example, maybe 3 should never have extra processing (e.g., it's a reserved doc status), but 4 or 5 might. However, they don't currently exist, so they weren't coded against. More than likely, though, this is part of some maintenance programming where only the minimum of changes required to make the program work were performed, leaving spaghetti behind.

      [Forum Guidelines]

      C 1 Reply Last reply
      0
      • B Bigdeak

        if (doc.status==3)
        {
        // With this Status, nothing should be done here.
        }
        else if (doc.status == 2 || doc.status == 1)
        {
        AddDoc(doc);
        }

        Finish();

        Should i laugh or cry?

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

        Take a switch to that guy. :-D

        C 1 Reply Last reply
        0
        • A AspDotNetDev

          Maybe that first if statement was included for the purpose of pseudo-documentation. For example, maybe 3 should never have extra processing (e.g., it's a reserved doc status), but 4 or 5 might. However, they don't currently exist, so they weren't coded against. More than likely, though, this is part of some maintenance programming where only the minimum of changes required to make the program work were performed, leaving spaghetti behind.

          [Forum Guidelines]

          C Offline
          C Offline
          Camilo Sanchez
          wrote on last edited by
          #6

          you're right

          A 1 Reply Last reply
          0
          • C Camilo Sanchez

            you're right

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #7

            So YOU'RE the culprit who wrote the code!

            [Forum Guidelines]

            C 1 Reply Last reply
            0
            • A AspDotNetDev

              So YOU'RE the culprit who wrote the code!

              [Forum Guidelines]

              C Offline
              C Offline
              Camilo Sanchez
              wrote on last edited by
              #8

              lol no, I have some lil' jewels of my own but no, that one isn't mine

              1 Reply Last reply
              0
              • P PIEBALDconsult

                Take a switch to that guy. :-D

                C Offline
                C Offline
                Chris Meech
                wrote on last edited by
                #9

                And then en**case** him in concrete. :)

                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

                R 1 Reply Last reply
                0
                • C Chris Meech

                  And then en**case** him in concrete. :)

                  Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

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

                  but that might break him.

                  "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                  E B 2 Replies Last reply
                  0
                  • R R Giskard Reventlov

                    but that might break him.

                    "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                    E Offline
                    E Offline
                    elchupathingy
                    wrote on last edited by
                    #11

                    The three above comments made my night...thanks :D

                    1 Reply Last reply
                    0
                    • H hammerstein05

                      I just keep reading it, my mouth agape. I've read three pieces of code in the past 24 hours that look like this!

                      A Offline
                      A Offline
                      akyriako78
                      wrote on last edited by
                      #12

                      I wish I could send you some of the code I'm reviewing currently but I can't due to a confidentiality momerandum. The above snippet looks like an oasis to me :wtf:

                      1 Reply Last reply
                      0
                      • B Bigdeak

                        if (doc.status==3)
                        {
                        // With this Status, nothing should be done here.
                        }
                        else if (doc.status == 2 || doc.status == 1)
                        {
                        AddDoc(doc);
                        }

                        Finish();

                        Should i laugh or cry?

                        O Offline
                        O Offline
                        oggenok64
                        wrote on last edited by
                        #13

                        Future enhancement perhaps.

                        1 Reply Last reply
                        0
                        • B Bigdeak

                          if (doc.status==3)
                          {
                          // With this Status, nothing should be done here.
                          }
                          else if (doc.status == 2 || doc.status == 1)
                          {
                          AddDoc(doc);
                          }

                          Finish();

                          Should i laugh or cry?

                          R Offline
                          R Offline
                          Ray Cassick
                          wrote on last edited by
                          #14

                          At times, when I have found things like this, I agree my first intent is to go find the person that wrote the code, but then, I sometimes stop and think, who REVIEWED IT and ALLOWED it into the code-base to start with? The does of course mean that you have a review cycle as part of your policies... Been to many places that don't, and then, yes, I run through the halls creaming for the head of the the programmer... and then use it as an example as to why they should implement code reviews :)


                          LinkedIn[^] | Blog[^] | Twitter[^]

                          B 1 Reply Last reply
                          0
                          • R Ray Cassick

                            At times, when I have found things like this, I agree my first intent is to go find the person that wrote the code, but then, I sometimes stop and think, who REVIEWED IT and ALLOWED it into the code-base to start with? The does of course mean that you have a review cycle as part of your policies... Been to many places that don't, and then, yes, I run through the halls creaming for the head of the the programmer... and then use it as an example as to why they should implement code reviews :)


                            LinkedIn[^] | Blog[^] | Twitter[^]

                            B Offline
                            B Offline
                            Bigdeak
                            wrote on last edited by
                            #15

                            The joke of this is: I know who has wrote this code... my boss...

                            R 1 Reply Last reply
                            0
                            • B Bigdeak

                              The joke of this is: I know who has wrote this code... my boss...

                              R Offline
                              R Offline
                              Ray Cassick
                              wrote on last edited by
                              #16

                              RUN! Run NOW! But slap them first :)


                              LinkedIn[^] | Blog[^] | Twitter[^]

                              1 Reply Last reply
                              0
                              • R R Giskard Reventlov

                                but that might break him.

                                "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                                B Offline
                                B Offline
                                BillW33
                                wrote on last edited by
                                #17

                                You guys are very punny. :laugh:

                                Just because the code works, it doesn't mean that it is good code.

                                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