3 ms·
When you are talking about making code "clear," I think it's important to ask "clear about what?" Is it: * Clear about what the machine is doing? * Clear abo
by piinbinary 7y ago
When you are talking about making code "clear," I think it's important to ask "clear about what?"
Is it:
* Clear about what the machine is doing?
* Clear about what the possible error cases are?
* Clear about the purpose of the code?
Go often prioritizes making it clear what the machine is doing over making the purpose of the code clear. In some languages you might write `newList = map(myFunc, myList)`. This is clear about what I intend, but not how it is accomplished[0]. The equivalent for-range loop in Go is clear about what it does at the expense of diluting the intent.
[0] for example, that map function could apply to the first element first, or the last element first, or it could apply to all the elements in parallel.