lundi 4 novembre 2019

Good practice to avoid code duplication Java

I have an specification interface lets call it Spec and two classes that implement it lets call them ImpA and ImpB. It worked great until I realized that few methods from ImpA and impB share the same implementation. I have tried to avoid it by declaring methods in Spec with default and implementing them right in it, but I'm sure that there is a better way to do it. Maybe some design pattern?

Aucun commentaire:

Enregistrer un commentaire