3 ms·
Here’s some counter-argument psuedo-code: // v1, mixing layers of abstraction x = a if exists, else first() y = b if exists, else second() resu
by IggleSniggle 6y ago
Here’s some counter-argument psuedo-code:
// v1, mixing layers of abstraction
x = a if exists, else first()
y = b if exists, else second()
result = third(x,y)
// v2, abstraction
result = getResult(a,b)
In v1, we have the semantics of x and y, so we understand that a “result” is obtained through the acquisition of x and y. Whether we need to understand this is a judgement call. But v2 opens a different “failure to understand” modality: “getResult” is so blackboxed that the only thing it really accomplished is indirection, without improving readability.
I love Clean Code, but I think it sometimes prematurely favors naming a new function and the resultant indirection.