3 ms·
It can be worthwhile replacing a wide interface with a narrow one. If an external interface has 30 methods but you only use 3, declare an interface with those 3
by skybrian 4y ago
It can be worthwhile replacing a wide interface with a narrow one. If an external interface has 30 methods but you only use 3, declare an interface with those 3 methods. Go makes it easy.
This is the interface equivalent of removing unused function parameters. Most people would say you shouldn’t add extra, unused parameters to a function just in case you might need them someday. Why require methods that you don’t use?