I developed an application in Java and I am refactoring it. I've just realized that I have several methods that perform almost the same action, and they have similar names as well:
RestrictedPersonServiceImpl.canViewPersonDetails
RestrictedPersonServiceImpl.isSubjectRestrictedToWorker
RestrictedPersonServiceImpl.isAnySubjectRestricted
RestrictedPersonServiceImpl.isSubjectRestricted
RestrictedPersonServiceImpl.isAnySubjectOfSubgroupRestrictedToWorker
I am pretty sure that it has to be a programming pattern to apply to deal with this situation. The solution that came to my mind before is to merge all of these methods in one and determining the behaviour by a parameter.
Is there a better choice?
Thanks everyone.
Aucun commentaire:
Enregistrer un commentaire