-
Book Overview & Buying
-
Table Of Contents
Practical Systems Programming in Go
By :
An interface is a Go mechanism for defining behavior that is implemented using a set of methods. Interfaces should not be unnecessarily complex. If you decide to create your own interfaces, then you should begin with a common behavior that you want to be used by multiple data types. Additionally, you should not design your programs by defining interfaces. You should start designing your program, wait for common behaviors to reveal themselves, and then convert those common behaviors into interfaces. Last, if the use of interfaces does not make your code simpler, consider removing some or all your interfaces. Interfaces define none, a single, or multiple type methods that need to be implemented. Once you implement the required type methods of an interface, that interface is satisfied implicitly. In simpler terms, once you implement the methods of an interface for a given data type, that interface is satisfied automatically for that data type.
Do not confuse...