6 ms·
Interfaces: * Allow for easy testing and mocking, especially to external services * Allow for easy swap out of functionality * Allow for useful tactics like
by brodouevencode 3y ago
Interfaces:
* Allow for easy testing and mocking, especially to external services
* Allow for easy swap out of functionality
* Allow for useful tactics like type switching, etc.
And a note on YAGNI:
> software rarely undergoes radical changes once in production
Depends on your definition of radical. But it's not uncommon to switch underlying databases, APIs, cloud providers (if using cloud native components), etc. "Yagni requires (and enables) malleable code." - Martin Fowler. According the Fowler interfaces ARE the definition of YAGNI.
YAGNI: Ya ain't gonna need it...until you do.