On 12/15/2014 11:59 AM, Robert Williams wrote:
What world is this that you live in where every line of code that’s written is
fully unit-tested
You took my example too literally; forget the unit tests. Imagine the
situation differently:
1. Someone wrote this function:
function add_five_pct($num) {
return $num * 1.10;
}
2. This function was then used to calculate profit margin and display
retail prices on your site and business has been great! Unknowingly,
you've been making 2x what was intended with no ill effects!
3. A new hire then went through this code on his own accord and decided,
'wait, this function is a bug!' and took it upon himself to fix it to
'$num * 1.05'.
Would you say the e-commerce site has been 'fixed' to work correctly?
Should the dev be praised for fixing the clearly broken function without
consulting anyone?
I cannot come up with a clearer explanation of how a 'silent' code fix
can foul up the bigger picture in non-beneficial ways. That's the
scenario that's being discussed here. The main point of contention is,
no one knows how much code exists in the wild that uses and relies on
this misbehavior. My argument is 'negligible', others say it's
'non-negligible'. And the whole comedy is, no one can actually provide
definitive numbers since nobody will ever know but a tiny portion of all
source code that is out there, so all arguments stem from 'meta'
evidence and personal experience.
--
Leon Sorokin
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php