5 ms·
Is the function doing something I care about? If yes, the name should tell me what that is. If not, why's it there at all?
by yCombLinks 4y ago
Is the function doing something I care about? If yes, the name should tell me what that is. If not, why's it there at all?
- xwdv 4y agoYou tell me. Seems like most functions can be eliminated and just replaced by comprehensions or a series of map, reduce, filters, sort, comparisons, etc, with small operations applied per element.
- yCombLinks 4y agoSure, they could. But I find naming these things explains to future users the point of why you're applying all of these functions. A chain of 10 filters / maps / comparisons / etc... do 0 to explain why a program cares about doing those things.
- xwdv 4y agoIf it is a true pure function that has already been proven and tested to be correct, you only need to be concerned with the output. The function itself will never have side effects you need to understand nor will it ever change.
- yCombLinks 4y agoRequirements change. I need a function that takes the same input, but the output is no longer valid. But I can't look at this "incredible pure function" and figure out how to do that.