mardi 17 décembre 2019

Interface Segregation Principle and Command Pattern Advices

I have an interface which contains 10 methods such as SendInvoice, SaveInvoiceAsDraft, SendInvoiceReceivedMail, DeleteInvoiceFromDrafts, CancelInvoice etc. I need to create 5 different concrete classes which will be implement these methods. 5 different class for 5 different vendors. So, every vendors have their own web services.

Some of these vendors don't have like CancelInvoice or some don't have DeleteInvoiceFromDrafts. I think I need to use interface segregation principle otherwise in some of concrete classes will thrown exceptions which can't provide implementation.

  • Should I create one interface for each one of methods?
  • How would you name these interfaces that contains only one method?
  • In case of using Command pattern I will need to use these concrete classes as Receiver. Do you have any suggestion, piece of code to show implementation of SOLID and Command Pattern or benefical link?

Aucun commentaire:

Enregistrer un commentaire