4 ms·
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 ad
by Cardinal7167 4y 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.
- suprfnk 4y agoThat seems like a more specific version of Postel’s law/the robustness principle: “be conservative in what you do, be liberal in what you accept from others" https://en.m.wikipedia.org/wiki/Robustness_principle https://en.m.wikipedia.org/wiki/Robustness_principle