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. Validation fails so lets not use it

Validation fails so lets not use it

Scheduled Pinned Locked Moved The Weird and The Wonderful
help
6 Posts 5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Obviously changed names etc. but this one I call "Bug Burial" (not bug fixing.. These bugs then come back as zombies) This is what was in place.

    //Checks to ensure the model is in a correct state that allows requested logic to run
    Func _validatorForOrderingABannana = SetupValidator();
    ...

    var valid = _validator(stuff);

    if(valid)
    {
    if(_globalBannnaOrderView == null)
    {
    _globalBannnaOrderView = new BannaOrderView();

        ...
    }
    else
    {
       \_globalBannanaOrderView.Focus();
    }
    

    I was then informed that validation logic was not working/running. I thought, "self, I am pretty sure we set that up. How can it not be running"

    Func _validatorForOrderingABannana = SetupValidator();
    ...

    bool valid = true;

    //Was checking for 'something' and creating an error when Bannana window opened
    if(_globalBannanaOrderView != null
    {
    valid = _validator(stuff);
    }

    if(valid)
    {
    if(_globalBannnaOrderView == null)
    {
    _globalBannnaOrderView = new BannaOrderView();
    ...
    }
    else
    {
    _globalBannanaOrderView.Focus();
    }

    Not sure if you see it right away, but the validator can't run (for the most part). The window is global purely so it is monitored if focus was switched and then the open command is fired again. Rather than opening a new window focus is returned to the old one (well in that case the validator will run). So rather than correcting the 'something' (which turned out to be a simple initialization error), the developer put a conditional in that could almost be replaced by

    if(false)

    Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

    F L C L 4 Replies Last reply
    0
    • L Lost User

      Obviously changed names etc. but this one I call "Bug Burial" (not bug fixing.. These bugs then come back as zombies) This is what was in place.

      //Checks to ensure the model is in a correct state that allows requested logic to run
      Func _validatorForOrderingABannana = SetupValidator();
      ...

      var valid = _validator(stuff);

      if(valid)
      {
      if(_globalBannnaOrderView == null)
      {
      _globalBannnaOrderView = new BannaOrderView();

          ...
      }
      else
      {
         \_globalBannanaOrderView.Focus();
      }
      

      I was then informed that validation logic was not working/running. I thought, "self, I am pretty sure we set that up. How can it not be running"

      Func _validatorForOrderingABannana = SetupValidator();
      ...

      bool valid = true;

      //Was checking for 'something' and creating an error when Bannana window opened
      if(_globalBannanaOrderView != null
      {
      valid = _validator(stuff);
      }

      if(valid)
      {
      if(_globalBannnaOrderView == null)
      {
      _globalBannnaOrderView = new BannaOrderView();
      ...
      }
      else
      {
      _globalBannanaOrderView.Focus();
      }

      Not sure if you see it right away, but the validator can't run (for the most part). The window is global purely so it is monitored if focus was switched and then the open command is fired again. Rather than opening a new window focus is returned to the old one (well in that case the validator will run). So rather than correcting the 'something' (which turned out to be a simple initialization error), the developer put a conditional in that could almost be replaced by

      if(false)

      Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

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

      Reminds me of an application I support that had the following gem in it. Not only was this method called only once in the entire solution, but apparently someone "forgot" to code anything in it. I'm sure this isn't the first time someone has seen this one, too.

      private bool IsValid()
      {
      return true;
      }

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

      T 1 Reply Last reply
      0
      • L Lost User

        Obviously changed names etc. but this one I call "Bug Burial" (not bug fixing.. These bugs then come back as zombies) This is what was in place.

        //Checks to ensure the model is in a correct state that allows requested logic to run
        Func _validatorForOrderingABannana = SetupValidator();
        ...

        var valid = _validator(stuff);

        if(valid)
        {
        if(_globalBannnaOrderView == null)
        {
        _globalBannnaOrderView = new BannaOrderView();

            ...
        }
        else
        {
           \_globalBannanaOrderView.Focus();
        }
        

        I was then informed that validation logic was not working/running. I thought, "self, I am pretty sure we set that up. How can it not be running"

        Func _validatorForOrderingABannana = SetupValidator();
        ...

        bool valid = true;

        //Was checking for 'something' and creating an error when Bannana window opened
        if(_globalBannanaOrderView != null
        {
        valid = _validator(stuff);
        }

        if(valid)
        {
        if(_globalBannnaOrderView == null)
        {
        _globalBannnaOrderView = new BannaOrderView();
        ...
        }
        else
        {
        _globalBannanaOrderView.Focus();
        }

        Not sure if you see it right away, but the validator can't run (for the most part). The window is global purely so it is monitored if focus was switched and then the open command is fired again. Rather than opening a new window focus is returned to the old one (well in that case the validator will run). So rather than correcting the 'something' (which turned out to be a simple initialization error), the developer put a conditional in that could almost be replaced by

        if(false)

        Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

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

        Collin Jasnoch wrote:

        "Bug Burial"

        This term reminds me of an incident when the project manager of the project I had been working previously called me to troubleshoot some issues in the app. When I checked out the relevant code to see what was wrong, I was taken aback to see that many lines of code has been commented en masse. When I asked the developer who was responsible for the mayhem, she simply replied "The compiler kept complaining on those lines no matter what I did, so ultimately I decided to comment them". Guess what? I ran out for my life from the nearest door..... :omg: :wtf: :confused:

        1 Reply Last reply
        0
        • L Lost User

          Obviously changed names etc. but this one I call "Bug Burial" (not bug fixing.. These bugs then come back as zombies) This is what was in place.

          //Checks to ensure the model is in a correct state that allows requested logic to run
          Func _validatorForOrderingABannana = SetupValidator();
          ...

          var valid = _validator(stuff);

          if(valid)
          {
          if(_globalBannnaOrderView == null)
          {
          _globalBannnaOrderView = new BannaOrderView();

              ...
          }
          else
          {
             \_globalBannanaOrderView.Focus();
          }
          

          I was then informed that validation logic was not working/running. I thought, "self, I am pretty sure we set that up. How can it not be running"

          Func _validatorForOrderingABannana = SetupValidator();
          ...

          bool valid = true;

          //Was checking for 'something' and creating an error when Bannana window opened
          if(_globalBannanaOrderView != null
          {
          valid = _validator(stuff);
          }

          if(valid)
          {
          if(_globalBannnaOrderView == null)
          {
          _globalBannnaOrderView = new BannaOrderView();
          ...
          }
          else
          {
          _globalBannanaOrderView.Focus();
          }

          Not sure if you see it right away, but the validator can't run (for the most part). The window is global purely so it is monitored if focus was switched and then the open command is fired again. Rather than opening a new window focus is returned to the old one (well in that case the validator will run). So rather than correcting the 'something' (which turned out to be a simple initialization error), the developer put a conditional in that could almost be replaced by

          if(false)

          Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

          C Offline
          C Offline
          Chris Berger
          wrote on last edited by
          #4

          Collin Jasnoch wrote:

          if(_globalBannnaOrderView == null) { _globalBannnaOrderView = new BannaOrderView(); ... } else { _globalBannanaOrderView.Focus(); }

          Are _globalBannanaOrderView and _globalBannnaOrderView different variables, or just a typo? Because doing that on purpose would be an even worse Coding Horror. :-D Also, if you mean the fruit, it's spelled Banana. Not that it really matters, but it might be easier to be consistent... (I see Banna, Bannna, and Bannana in just the quoted section)

          1 Reply Last reply
          0
          • L Lost User

            Obviously changed names etc. but this one I call "Bug Burial" (not bug fixing.. These bugs then come back as zombies) This is what was in place.

            //Checks to ensure the model is in a correct state that allows requested logic to run
            Func _validatorForOrderingABannana = SetupValidator();
            ...

            var valid = _validator(stuff);

            if(valid)
            {
            if(_globalBannnaOrderView == null)
            {
            _globalBannnaOrderView = new BannaOrderView();

                ...
            }
            else
            {
               \_globalBannanaOrderView.Focus();
            }
            

            I was then informed that validation logic was not working/running. I thought, "self, I am pretty sure we set that up. How can it not be running"

            Func _validatorForOrderingABannana = SetupValidator();
            ...

            bool valid = true;

            //Was checking for 'something' and creating an error when Bannana window opened
            if(_globalBannanaOrderView != null
            {
            valid = _validator(stuff);
            }

            if(valid)
            {
            if(_globalBannnaOrderView == null)
            {
            _globalBannnaOrderView = new BannaOrderView();
            ...
            }
            else
            {
            _globalBannanaOrderView.Focus();
            }

            Not sure if you see it right away, but the validator can't run (for the most part). The window is global purely so it is monitored if focus was switched and then the open command is fired again. Rather than opening a new window focus is returned to the old one (well in that case the validator will run). So rather than correcting the 'something' (which turned out to be a simple initialization error), the developer put a conditional in that could almost be replaced by

            if(false)

            Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.

            L Offline
            L Offline
            Lutoslaw
            wrote on last edited by
            #5

            Collin Jasnoch wrote:

            not bug fixing.. These bugs then come back as zombies

            +5 for this line :laugh:

            Greetings - Jacek

            1 Reply Last reply
            0
            • F fjdiewornncalwe

              Reminds me of an application I support that had the following gem in it. Not only was this method called only once in the entire solution, but apparently someone "forgot" to code anything in it. I'm sure this isn't the first time someone has seen this one, too.

              private bool IsValid()
              {
              return true;
              }

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

              T Offline
              T Offline
              thoiness
              wrote on last edited by
              #6

              I've actually done something like this (but never left it in the production code) on a rapidly evolving piece of a class. The purpose behind it is that you originally start out with a method with let's say, 100 lines of code, then the person that was driving the requirements no longer wants the checking, so you go back, and in order to test your entire application quickly without refactoring, you throw the "return true" in there. Not saying it isn't stupid to allow something like that to end up in production, just saying I've actually done it before for quick testing.

              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