Skip to content

Tag: code-duplication

How to avoid duplicate code in Java when you require the same class in two separated applications?

For the sake of simplicity, let’s say that I have a class named “Dog”. Then I have two separated applications containing implementations of that class. Application “A” does something with the Dog class. Application “B” does another something with the Dog class. Both applications require the Dog class, hence it would be duplicated. Now let’s say for a moment that: