What's in a name?
https://go.dev/talks/2014/names.slide#1
October 2014
Andrew Gerrand Google Inc.
long names obscure what the code does.(長い名前はコードが何をするのか 不明瞭 にする)
The greater the distance between a name’s declaration and its uses, the longer the name should be.
(名前の宣言とそれを使用している箇所との距離が遠いほど、名前はより長く付けるべきである)
Good
code:go
func RuneCount(b []byte) int {
i, n := 0, 0
for i < len(b) {
if bi < RuneSelf {
i++
} else {
_, size := DecodeRune(bi:)
i += size
}
n++
}
return n
}
Bad
code:go
func RuneCount(buffer []byte) int {
index, count := 0, 0
for index < len(count) {
if bufferi < RuneSelf {
index++
} else {
_, size := DecodeRune(bufferindex:)
index += size
}
count++
}
return count
}
#Golang