- code to an interface not an implementation
- segregate interfaces, don’t overload them with responsibilities
You could have a really skinny interface (one method call only):
class TaxLogic { data = iDatabase.loadOneDatabaseRow(id); process(data); } interface IDatabase { loadOneDatabaseRow(id); } class PostgresDb implements IDatabase { loadOneDatabaseRow(id) {...} }
- code to an interface not an implementation
- segregate interfaces, don’t overload them with responsibilities