Skip to content

Instantly share code, notes, and snippets.

@qbig
Created August 17, 2018 14:34
Show Gist options
  • Select an option

  • Save qbig/dbbe95ff734ec757d77d17211fa6d04c to your computer and use it in GitHub Desktop.

Select an option

Save qbig/dbbe95ff734ec757d77d17211fa6d04c to your computer and use it in GitHub Desktop.
Interface names

-er suffix

By convention, one-method interfaces are named by the method name plus an -er suffix or similar modification to construct an agent noun: Reader, Writer, Formatter, CloseNotifier etc.

There are a number of such names and it's productive to honor them and the function names they capture. Read, Write, Close, Flush, String and so on have canonical signatures and meanings. To avoid confusion, don't give your method one of those names unless it has the same signature and meaning. Conversely, if your type implements a method with the same meaning as a method on a well-known type, give it the same name and signature; call your string-converter method String not ToString.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment