Suppose you have a method that con­cat­en­ates strings, like the method in code snip­pet 1 below. One day, you come to a point where this method does not suf­fice any­more. You need an addi­tional para­meter, to allow the user to place a char­ac­ter between each con­cat­en­ated string. That’s easy, right? You just alter the method, and its sig­na­ture, as in code snip­pet 2.

Works like a charm. We can just wrap this up and leave work early, can’t we?

No, we can’t. What about all the other code in your pro­ject (or in other people’s pro­jects) that uses the method you have just altered? That code now doesn’t work any­more. It doesn’t even com­pile any­more, because you changed the method’s sig­na­ture. Is there a way to pre­vent this from happening?

Continue read­ing