2 ms·
Deep vs. Shallow Go Interfaces
- deleted 2y ago[deleted]
- tpaschalis 2y agoAuthor here, thanks for posting this! If anyone has any feedback, questions, or any additional examples of deep/shallow abstractions they've used recently, let me know!
- jasonthorsness 2y agoOne common situation I’ve seen is when you have a core primitive like io.Reader then lots of “extension” functions that solely depend on the core interface like io.ReadAll are implemented alongside in the same package. This lets you add functionality to all implementations of an interface and keeps the interface simple.