3 ms·
> Also, what happens if you pass a pizza to those functions twice? Are they idempotent or do you end up eating cinder? That is surely about state and mutable d
by afandian 3y ago
> Also, what happens if you pass a pizza to those functions twice? Are they idempotent or do you end up eating cinder?
That is surely about state and mutable data, not code structure. And factored code makes it _easier_ to write more stateless code.
- mrkeen 3y agoYeah, that's the most frustrating part of the debate here. Arguing about the difference between: number := prepareZero addOne(number) addTwo(number) addThree(number) return number and number = 0 number += 1 number += 2 number += 3 return number When either of the following would be far better: addThree (addTwo (addOne prepareZero)) or return 0 + 1 + 2 + 3;