4 ms·
Nothing is being abstracted here, and nothing is gained by indirection Making the rest of the function readable would be a win. If the two functions in the if-
by stcredzero 7y ago
Nothing is being abstracted here, and nothing is gained by indirection
Making the rest of the function readable would be a win. If the two functions in the if-then are quite long, and if that clause appears in many places, then that could be a big win in the aggregate.
- chriswarbo 7y agoSuch indirection requires readers to go look up the definitions of other things to understand the meaning of each function. The nice thing about abstraction is that we don't need to go look up the definitions (unless we're tracking down a bug that's in those parts!): we can read a line like `if checkHasPermission(x):` and get the gist of what's happening, and skip over it if we don't care about the permission system at the moment.
- tanseydavid 7y agoWhen done properly, a function/method should be clear in terms of intent at the point of call. I will be the first to admit that proper-naming is most usually rather challenging .
- chriswarbo 7y ago> When done properly, a function/method should be clear in terms of intent at the point of call. Yes, of course, but that (I claim) implies that the function/method has abstracted something. The parent was claiming that using indirection to hide code can be useful for readability, even when there is nothing being abstracted.