3 ms·
There are countless overused abstractions and sources of accidental complexity. Interfaces though are one of my favorite tools, in most languages. The primary
by klabb3 2y ago
There are countless overused abstractions and sources of accidental complexity. Interfaces though are one of my favorite tools, in most languages.
The primary function of an interface is of course to swap out implementations. The first and most common use-case is generally for tests. You can do it other ways too, but they are usually more invasive.
That said, it’s easy to add interfaces later (which is one reason it’s a good abstraction). I would still defer it until needed.
- bazoom42 2y agoMy rule of thumb: If an interface only have a single implementation, it is likely superflous.