|
|
|
|
|
by Cardinal7167
1190 days ago
|
|
Go even has a mantra for this: “accept interfaces, return concrete types”. In the example, I would think to design it such that Oil is just an interface with adapters for either user specified oilType or oilInventory or whatever. |
|
“be conservative in what you do, be liberal in what you accept from others"
https://en.m.wikipedia.org/wiki/Robustness_principle