2022.08.31

2022.08 Vol. 2

A little bit of names

Think Less

I love go because I don’t have to think about a lot of stuff while working with it. There is just “one way” to do a lot of things. One thing which is still up for interpretation though is naming things (oh god).

There is a pretty strong exiting convention:

These conventions allow for less thinking on choosing names as well as easy commenting.

// Read from the thingy.
func Read(thing thingy) error { ... }

// Pool responsible for managing funds.
type Pool struct { ... }

The function and struct names flow easily into the documentation

I follow a few more rules to further limit the amount of thinking I have to do:

This has a nice side effect of forcing the most thought into the function names and keeping them clear and concise, instead of fighting that battle very time I have to make up another name that isn’t manager.