July 2019
Intermediate to advanced
502 pages
14h
English
Interfaces are one of the best tools a software engineer can use. Once you expose something as an interface, you can freely change the implementation behind it. Interfaces are a construct that's being used within a single process. They are extremely useful for testing interactions with other components, which are plentiful in microservice-based systems. Here is one of the interfaces of our sample application:
type UserManager interface { Register(user User) error Login(username string, authToken string) (session string, err error) Logout(username string, session string) error}
The UserManager interface defines a few methods, their inputs, and outputs. However, it doesn't specify the semantics. For example, ...