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