> It's not noise if you can understand every line written though.
If I can understand every line of a 10,000 line program, is it not still noise compared to a 100 line program that accomplishes the same goal?
> If you don't have to think too much about what code does, you can get a better overview of what's going on.
That's the problem with Go. I do have to think about what the code does, because the ability to abstract things to a higher level is virtually nonexistent.
Take the following:
items
.select { |item| whitelist.include?(item) }
.sort_by { |item| item.price }
.map { |item| item.name }
I don't have to think about what this code does at all. It's
obvious. And I am extremely confident that there are no bugs. The Golang equivalent?
var tmp []item
var res []item
for _, item := range items {
for _, entry := range whitelist {
if item == entry {
tmp = append(tmp, item)
break
}
}
}
sort.Slice(res, func(i, j item) bool {
return tmp[i].Price < tmp[j].Price
})
for _, item := range items {
res = append(res, item.Name)
}
Sure I can understand every line of the latter. It's still noise. And it's only comprehensible by sitting down and carefully reading every single line. Are there bugs? I think not, but I'd have to think through it to be sure. Go took what should have been a simple problem and somehow turned it into something that would feel at home if I was writing a device driver.