3 ms·
True, if you're a really good engineer, you might implement an add() function to remove the duplicated addition everywhere...
by gitgud 7y ago
True, if you're a really good engineer, you might implement an add() function to remove the duplicated addition everywhere...
- Aeolun 7y agoOh. That’s helpful! Makes it much easier if you ever have to modify the behavior of addition! Like, if a new discovery in math is made and it turns out that 1+1 isn’t always 2.
- Viliam1234 7y agoThe real benefits will appear at testing, where you can replace the actual addition with a mock object that expects parameters 1 and 1 and returns a fixed value 2, without having to do the calculation.