This is a question about dependency injection. When constructing a service object, we pass in collaborators via the constructor in the construction phase. The service object would implement an interface, and that would be called during the run-phase.
Sometimes is is difficult to know if a particular object should be passed via the constructor or be part of the interface implemented by the service class?
Are there any rules about choosing one option over the other? The question is most difficult when you know the interface is only going to be called once in the scenario you are coding for.
I like to think of it like this:
A lot of the art is in framing the problem correctly. For example, we might say to ourselves “I need to create a new row in the user table.” From that perspective, either of these signatures seems fine:
However, we can break down our task definition:
Intent: Create a new user
Implementation detail: A user is a row in a table
Let’s instead frame the task as “I need to create a user”. This gives us a way to evaluate the two signatures above, favoring the one which matches our intent:
Analysis of an operation’s intent and the applicable scope of its data generally gives solid results.