4 ms·
Cognitive load is unrelated to SLoC. This expression let a = x.iter().filter(...).apply(...).map(...); is equally or even potentially _more_ cognitively
by preseinger 4y ago
Cognitive load is unrelated to SLoC.
This expression
let a = x.iter().filter(...).apply(...).map(...);
is equally or even potentially _more_ cognitively complex than this expression
for _, v := range x {
if !filter(v) {
continue
}
vv := apply(v, ...)
vm := map(vv, ...)
...
}
- lamontcg 4y agofocusing on a pedantic detail that i clearly didn't intend and which doesn't change my point. consider it from a blocks-of-code metric, or some better slightly more abstract metric, that isn't affect by simple things like whitespace transformations, and try assuming that we all understand that we should write code that isn't monstrous to begin with.
- preseinger 4y ago"Monstrous" is an opinion, not a metric. I would personally much rather maintain the code in the second example than in the first.