mardi 12 novembre 2019

Coupling - How does changing one module effect another OTHER THAN changing method signature or return type?

In a high coupling environment, Changing one module affects another. Okay, but I can't see how is it possible (other than changing method signature or return type)?

Well, If I change one class then, it only way it can break the code in some other class if:

  1. If I suddenly change the return type of a method - then I would have to go to another class and fix the mismatch of types.
  2. If I change the method signature - then I would have to go to all dependent classes and change the method arguments everywhere the changed method is called.

For the same reason, It is good to depend on abstractions (interfaces), so that we have a guarantee that defined methods will be there.

Other than this, How else could changing a class affect another depending class?

Aucun commentaire:

Enregistrer un commentaire