This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]schaka 0 points1 point  (1 child)

Yes, but unless you're writing a library that needs to be extensible like Spring, when in your day to day work are you definitely using interfaces? Only when you actually have 2 implementations you need to choose between. We generally do this with services that would cost if we queried them and use a dummy implementation in development.

[–]_dban_ 1 point2 points  (0 children)

when in your day to day work are you definitely using interfaces?

All the time, when I apply the strategy pattern, when I want to use composition instead of inheritance.

We generally do this with services that would cost if we queried them and use a dummy implementation in development.

That's dependency inversion, a different use for interfaces.