The key word you're looking for here is "contract" (or "interface", although this one is a bit more ambiguous for languages that have an interface
keyword).
When two components interact with one another, they would ideally remain mostly independent of one another, each one being independently capable of changing its internal implementation without the other needing to be made aware of it. This is what we try to achieve using encapsulation and general clean coding.
However, there is an inevitable link between the two. Their interaction inherently means that one will call on the other in some way, using some syntax. Though it's not the only way, let's assume their interaction is that A calls one of B's methods.
In other words, somewhere in the A
logic you will find myB.DoSomething(foo);
. I can change the implementation of A, e.g. only calling this method in certain situations, without it impacting B's implementation of the DoSomething
method itself. Similarly, I can change B's implementation of the DoSomething
method, without that changing anything about A's logic (i.e. deciding when to call the method).
However, when I change the signature of the method, this inherently means that both A and B have to respond to this change. There's no way around that. The interaction is inherently shared between the two interacting components.
but surely the implementation is arbitrary; it could be unimplemented (ignoring the parameters entirely), and therefore not dependent on the signature at all
If you're going to ignore the newly added parameters, there's no point to adding these parameters in the first place. You're trying to come up with nonsensical edge cases to the advice.
However, in the interest of humoring your quest for edge cases:
- If the added parameter is an optional one (e.g. C# allows for this), then it's possible that the consumer does not need to update their call.
- If you change a method parameter's type in a way that the prior type can be implicitly casted to the newer type (e.g.
int
to float
), the consumer does not need to update their call either.
That being said, if you're trying to learn things, I suggest you focus on what's being conveyed rather than jumping straight into looking for edge cases. Almost every rule has an edge case or exception, and while it is possible to define things in a way to account for more edge cases, this significantly complicates the learning material, which is detrimental to how easy it is to learn the core concept.
(x, y, width, height)
, and change that to(left, top, right, bottom)
.