Curriculum Idioms & ecosystem The small-interface idiom exercise 7 · fill-line
The small-interface idiom
About this theme
io.Reader { Read(p []byte) (n int, err error) }. One method. Go interfaces are typically tiny because implicit satisfaction rewards it — small interfaces are easy to satisfy accidentally, which is good. The community phrase: "accept interfaces, return structs." Funcs take the smallest interface they need.