|
|
|
|
|
by OkayPhysicist
1153 days ago
|
|
While I sympathize with the avoidance of "clever" code, it's worth pointing out that there is an opposite direction: don't re-implement standard abstractions. There are many standard abstractions that it is safe to assume that literally everyone qualified to touch code will know. If they don't, your priority should be either replacing them teaching them, not replacing the code. Different languages and paradigms have different examples of such abstractions, but a trivial example is loops: while(i < itt.length)
x = itt[i]
i = i + 1
for(i=0;i<itt.length;i++)
x = itt[i]
foreach(x in itt)
There is a decreasing amount of mental overhead in reading each one of those, because I know what a foreach loop does, and I don't need to be on the lookout for strange behavior.IMO, Go overcorrects on the "don't get clever" ideology to the point of needlessly increasing the amount of mental overhead required to read some code. The entire language was designed to solve a problem that should have been solved at the hiring level. |
|