I am building a new RESTful service that interacts with other microservices.
The routine task is to fetch some data from another RESTful service, filter it, match it against existing data and return a response.
My question is is it a good design pattern to always separate steps "get data" and "filter it" in two different classes and name one is as EntityDataService
and the second one is simply EntityService
?
For instance, I can make a call to a service that returns a list of countries that has to be filtered against some conditions as inclusion in EU or date of creation, etc.
In this case, which option is better:
- separate
CountryDataService
class that only have one methodgetAllCountries
andEUCountryService
that filters them - make one class
CountryService
with public methodsgetEUCountries
andgetCountriesCreatedInDateRange
and privategetAllCountries
Which one is better?
I'm trying to follow KISS
pattern but also want to make my solution maintainable and extensible.
Aucun commentaire:
Enregistrer un commentaire