3 ms·
Honestly, how often do you need any deeply nested arithmetic expressions in your code? I very rarely use anything beyond an increment by one. Any time you are i
by sklogic 11y ago
Honestly, how often do you need any deeply nested arithmetic expressions in your code? I very rarely use anything beyond an increment by one. Any time you are invoking nested logic you are already summoning a complexity problem. Luckily, it can be avoided in most of the real world cases.
- MereInterest 11y agoHow often? Quite. "Take these two points and extrapolate." "Solve this quadratic equation." Whether you need more complicated arithmetic expressions depends entirely on what field you are working in. I would not call `8+6-(4+5)*7` complicated by any means.
- sklogic 11y agoIs it really that often? More than 10% of lines of code containing nested arithmetic expressions? Sorry, I find it hard to believe.
- MereInterest 11y agoIf 10% is your threshold of "often", then no. Arithmetic expressions do show up often enough in code that I work on that they should be immediately readable.
- sklogic 11y agoNobody is stopping you from keeping them as readable as you like. The question here is in readability of the remaining 90% of the code, and this is exactly where nested expressions are evil and must be flattened.