A Talk About Naming Things – mheap
When the section on interfaces came up I knew what was coming. I'm totally sold on this already. It doesn't matter that you're working with an interface. All that matters is that you're working with an object with certain public methods available. How it accomplishes the task is nothing to do with you – so long as your collaborator respects your contract (and you respect it's public API e.g. don't call public methods that aren't in the interface) then everyone's happy.
Instead of adding Interface
to differentiate your interface from your implementation, make your implementation more specificPaymentProcessor
and PaymentProcessorInterface
doesn't tell me anything. StripePaymentProcessor
and PaymentProcessor
lets me infer that we're processing payments via Stripe
Read full article from A Talk About Naming Things – mheap
No comments:
Post a Comment