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. It's not the most horrible code but it is pointless

It's not the most horrible code but it is pointless

Scheduled Pinned Locked Moved The Weird and The Wonderful
com
8 Posts 6 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.
  • A Offline
    A Offline
    Andy Brummer
    wrote on last edited by
    #1

    bool hasWarnings = false;
    if (!hasWarnings)
    {
    hasWarnings = true;
    }

    Curvature of the Mind

    P F 2 Replies Last reply
    0
    • A Andy Brummer

      bool hasWarnings = false;
      if (!hasWarnings)
      {
      hasWarnings = true;
      }

      Curvature of the Mind

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

      I just saw a piece of javascript today which effectively looked like this:

      function check_somethingOrOther()
      {
      someVariable = false;
      setTimeout("check_somethingOrOther()", 500);
      }

      Now, I know that someVariable was obviously meant to do something, but this is the only place in the code that it's actually used. Optimising this code was really simple.

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      A 1 Reply Last reply
      0
      • A Andy Brummer

        bool hasWarnings = false;
        if (!hasWarnings)
        {
        hasWarnings = true;
        }

        Curvature of the Mind

        F Offline
        F Offline
        fjdiewornncalwe
        wrote on last edited by
        #3

        I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.

        private bool IsValid()
        {
        return true;
        }

        I wasn't, now I am, then I won't be anymore.

        A Q 2 Replies Last reply
        0
        • F fjdiewornncalwe

          I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.

          private bool IsValid()
          {
          return true;
          }

          I wasn't, now I am, then I won't be anymore.

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

          If it were a polymorphic function that could be overridden by a derived class then it could make sense. However, in your context it does seem very strange.

          F 1 Reply Last reply
          0
          • P Pete OHanlon

            I just saw a piece of javascript today which effectively looked like this:

            function check_somethingOrOther()
            {
            someVariable = false;
            setTimeout("check_somethingOrOther()", 500);
            }

            Now, I know that someVariable was obviously meant to do something, but this is the only place in the code that it's actually used. Optimising this code was really simple.

            I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

            Forgive your enemies - it messes with their heads

            My blog | My articles | MoXAML PowerToys | Onyx

            A Offline
            A Offline
            Andy Brummer
            wrote on last edited by
            #5

            Yes, but what if it changes. You have to make sure it is really false! :-D

            Curvature of the Mind

            1 Reply Last reply
            0
            • A Al_Brown

              If it were a polymorphic function that could be overridden by a derived class then it could make sense. However, in your context it does seem very strange.

              F Offline
              F Offline
              fjdiewornncalwe
              wrote on last edited by
              #6

              Unfortunately, no. This class was never inherited. I honestly don't think the guy who wrote it originally even knew what that was.

              I wasn't, now I am, then I won't be anymore.

              1 Reply Last reply
              0
              • F fjdiewornncalwe

                I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.

                private bool IsValid()
                {
                return true;
                }

                I wasn't, now I am, then I won't be anymore.

                Q Offline
                Q Offline
                QuiJohn
                wrote on last edited by
                #7

                PogoboyKramer wrote:

                I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.

                You fool! Now *nothing* will be valid. Wasn't it better when it was ALL valid? How is anything supposed to work unless it's valid?


                He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.

                R 1 Reply Last reply
                0
                • Q QuiJohn

                  PogoboyKramer wrote:

                  I actually removed this one from a piece of code this week. And believe it or not, it was actually being called.

                  You fool! Now *nothing* will be valid. Wasn't it better when it was ALL valid? How is anything supposed to work unless it's valid?


                  He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.

                  R Offline
                  R Offline
                  richard_k
                  wrote on last edited by
                  #8

                  LOL!!!!!

                  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