Brian Mearns
Nov 20, 2020

I would argue that a single larger method that encapsulates all of the countries is also clutter. It also violates Single Responsibilty: this method will have to change if the way rates are calculated for any country changes. Or if you add or remove a country.

A public `calculateRates(country)` function is appropriate, but I suggest the implementation of that function should be a switch on the country that delegates out to private methods for each country.

Brian Mearns
Brian Mearns

Written by Brian Mearns

Software Engineer since 2007 ・ Parent ・ Mediocre Runner ・ Flower and Tree Enthusiast ・ Crappy Wood Worker ・ he/him or they/them

No responses yet