|
|
|
|
|
by Zak
3425 days ago
|
|
I think replacing common usage patterns of generic control structures with named constructs adds clarity: for(blah blah blah)
tells the reader nothing more than there's going to be a loop, but map(blah blah blah)
tells the reader one sequence is going to be transformed into another by applying a function to each item. That's more informative to the reader if used for its intended purpose. It has the opposite effect if abused to repeatedly call a function mainly for its side-effects.All programming techniques should be viewed as means to write code that's some combination of readable, reliable and performant, not as ends themselves. |
|
Except in this case it wasn't actually a sequence, but an Optional/Either and it wasn't about transforming that sequence but about error handling. So in a way the code wasn't even not intention-revealing, it was actually deceptive.