Curriculum Idioms & ecosystem The small-interface idiom exercise 4 · fill-word
The small-interface idiom
Type the method name that makes a type implement
fmt.Stringer. The method takes no arguments and
returns a string.
TypeScript reference
Fill the blanks →
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.