Skip to content
Advertisement

Tag: design-patterns

Design pattern to reduce cyclomatic complexity

I have to send invoices to cutomers through the related customer’s API. Each customer chooses how to be contacted (email, fax, sms…). My problem is that each time I add a new “contact type” I increase the cyclomatic complexity of my script. Here is my code : As you can see the switch statement of InvoiceSender::send is increased each time

Advertisement