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. Code WTF(s) OTD

Code WTF(s) OTD

Scheduled Pinned Locked Moved The Lounge
csharpdatabase
15 Posts 12 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.
  • H Harvey Saayman

    I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.

    timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
    // Note that timeAtendancePunch.MiscCategoryID is of type long

    timeAtendancePunch.PunchTypeID = 0;
    // This is a foreign key in a static table in the db, but the ID's aren't static, their identity columns

    private void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
    {
    if (rdbPunchKey.Checked)
    {
    grbKeyType.Visible = true;
    }
    else
    {
    grbKeyType.Visible = false;
    }
    }
    // Note, rdbPunchKey is a radio button and grbKeyType is a group box

    And there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.

    Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

    H Offline
    H Offline
    Henry Minute
    wrote on last edited by
    #4

    Errr.... there is a coding horrors section, you know?

    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

    H M 2 Replies Last reply
    0
    • H Harvey Saayman

      leppie wrote:

      it is handy for setting breakpoints on certain conditions

      All it does is if one of four radio buttons are checked, a group box is made visible, otherwise its invisible.

      grbKeyType.Visible = rdbPunchKey.Checked

      That's what I would have done...

      leppie wrote:

      In your case, it probably does not matter.

      No it doesn't, but I expect more of a programmer that has the credentials this one has... Much more That last example is right up there with if (someBooleanCondition == true) Miskien is ek net vol kak...

      Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

      J Offline
      J Offline
      JacquesDP
      wrote on last edited by
      #5

      miskien is jy ;P

      No matter how long he who laughs last laughs, he who laughs first has a head start!

      1 Reply Last reply
      0
      • H Henry Minute

        Errr.... there is a coding horrors section, you know?

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        H Offline
        H Offline
        Harvey Saayman
        wrote on last edited by
        #6

        I'm well aware of that, but this is not a coding horror, its a coding WTF :laugh:

        Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

        H 1 Reply Last reply
        0
        • H Henry Minute

          Errr.... there is a coding horrors section, you know?

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          M Offline
          M Offline
          Michael Bookatz
          wrote on last edited by
          #7

          Well said that man!

          1 Reply Last reply
          0
          • H Harvey Saayman

            I'm well aware of that, but this is not a coding horror, its a coding WTF :laugh:

            Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #8

            Put in a request for a new forum! We do have a Site Bugs and Suggestions forum, you know? :-D

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            1 Reply Last reply
            0
            • H Harvey Saayman

              I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.

              timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
              // Note that timeAtendancePunch.MiscCategoryID is of type long

              timeAtendancePunch.PunchTypeID = 0;
              // This is a foreign key in a static table in the db, but the ID's aren't static, their identity columns

              private void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
              {
              if (rdbPunchKey.Checked)
              {
              grbKeyType.Visible = true;
              }
              else
              {
              grbKeyType.Visible = false;
              }
              }
              // Note, rdbPunchKey is a radio button and grbKeyType is a group box

              And there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.

              Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

              J Offline
              J Offline
              J4amieC
              wrote on last edited by
              #9

              Harvey Saayman wrote:

              but the ID's aren't static, their identity columns

              Grammer WTF OTD sorry, couldn't resist. :-\

              P 1 Reply Last reply
              0
              • H Harvey Saayman

                I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.

                timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
                // Note that timeAtendancePunch.MiscCategoryID is of type long

                timeAtendancePunch.PunchTypeID = 0;
                // This is a foreign key in a static table in the db, but the ID's aren't static, their identity columns

                private void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
                {
                if (rdbPunchKey.Checked)
                {
                grbKeyType.Visible = true;
                }
                else
                {
                grbKeyType.Visible = false;
                }
                }
                // Note, rdbPunchKey is a radio button and grbKeyType is a group box

                And there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.

                Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                S Offline
                S Offline
                Simon P Stevens
                wrote on last edited by
                #10

                Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code.

                Simon

                S 1 Reply Last reply
                0
                • H Harvey Saayman

                  I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.

                  timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
                  // Note that timeAtendancePunch.MiscCategoryID is of type long

                  timeAtendancePunch.PunchTypeID = 0;
                  // This is a foreign key in a static table in the db, but the ID's aren't static, their identity columns

                  private void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
                  {
                  if (rdbPunchKey.Checked)
                  {
                  grbKeyType.Visible = true;
                  }
                  else
                  {
                  grbKeyType.Visible = false;
                  }
                  }
                  // Note, rdbPunchKey is a radio button and grbKeyType is a group box

                  And there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.

                  Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                  C Offline
                  C Offline
                  Caslen
                  wrote on last edited by
                  #11

                  Anyone with 3 pages of programming qualifications on his CV has obviously spent too much time in the classroom and not enough time doing real work.

                  1 Reply Last reply
                  0
                  • H Harvey Saayman

                    leppie wrote:

                    it is handy for setting breakpoints on certain conditions

                    All it does is if one of four radio buttons are checked, a group box is made visible, otherwise its invisible.

                    grbKeyType.Visible = rdbPunchKey.Checked

                    That's what I would have done...

                    leppie wrote:

                    In your case, it probably does not matter.

                    No it doesn't, but I expect more of a programmer that has the credentials this one has... Much more That last example is right up there with if (someBooleanCondition == true) Miskien is ek net vol kak...

                    Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                    R Offline
                    R Offline
                    Russell Jones
                    wrote on last edited by
                    #12

                    Often you'll need to set more than one thing or add some debug code Maybe the developer had problems with that code not working and added a debugging line or a breakpoint or maybe he saw that in the future he might need to enable a menu option if (rdbPunchKey.Checked) { grbKeyType.Visible = true; EnableSomeMenuOption(); Console.WriteLine("Button Checked"); } I definitely wouldn't see that as a wtf, there could be loads of reasons why that ended up like that. It doesn't look like the kind of code that's going to sitting in a big loop and if it is then there are probably bigger issues with the code than an unnecessary if statement Russ

                    1 Reply Last reply
                    0
                    • S Simon P Stevens

                      Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code.

                      Simon

                      S Offline
                      S Offline
                      Sundance Kid
                      wrote on last edited by
                      #13

                      Everyone makes mistakes. If you look back on your code in 5 years time I'm sure you'll be horrified by what you thought at the time was fantastic code. QFT!!!

                      1 Reply Last reply
                      0
                      • J J4amieC

                        Harvey Saayman wrote:

                        but the ID's aren't static, their identity columns

                        Grammer WTF OTD sorry, couldn't resist. :-\

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #14

                        J4amieC wrote:

                        Grammer WTF OTD

                        That would be Kelsey then. Would he be using grammar?

                        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                        My blog | My articles | MoXAML PowerToys | Onyx

                        1 Reply Last reply
                        0
                        • H Harvey Saayman

                          I'm busy making some changes to my front end application and I just came across some horrifying code written by my ex colleague.

                          timeAtendancePunch.MiscCategoryID = (short)int.Parse(cmbChoose.SelectedValue.ToString());
                          // Note that timeAtendancePunch.MiscCategoryID is of type long

                          timeAtendancePunch.PunchTypeID = 0;
                          // This is a foreign key in a static table in the db, but the ID's aren't static, their identity columns

                          private void rdbPunchKey_CheckedChanged(object sender, EventArgs e)
                          {
                          if (rdbPunchKey.Checked)
                          {
                          grbKeyType.Visible = true;
                          }
                          else
                          {
                          grbKeyType.Visible = false;
                          }
                          }
                          // Note, rdbPunchKey is a radio button and grbKeyType is a group box

                          And there is many many more of this... All this is written by a guy with 3 pages of programming qualifications on his CV(Including MS certifications) and several years commercial experience.

                          Harvey Saayman - South Africa Software Developer .Net, C#, SQL you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming) 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

                          M Offline
                          M Offline
                          Member 1709723
                          wrote on last edited by
                          #15

                          in the last example, he is just being verbose - nothing wrong with that could have been done on purpose for any number of reasons. however, someone with time on the job, all things being equal, would normally write grbKeyType.Visible = rdbPunchKey.Checked given a choice i would rather see this kind of WTFs than the ones that introduce logic errors let this be a lesson for all you certifications fanboys...

                          Opium is my business. The bridge mean more traffic. More traffic mean more money. More money mean more power. Speed is important in business. Time is money. You said opium was money. Money is Money. Well then, what is time again? icalburner

                          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