I was modifying an overridden method of a subclass. In order to determine the impact of the change, I went through all possible scenarios and tested them.
The problem is, the “all possible scenarios” are determined by reading business use cases, putting break point to find out when this particular overridden method is being hit instead of others.
Is there a reliable or programmatic way to find out about impacts? For example, if it is not an overridden method, I can simply “Find All Instance” or even using grep to find where it is getting called. Is there a similar measure for overridden methods? Or is it just an inconvenience of polymorphism?
There may be scientific approaches to this topic. But in general you will likely have to go with the “just an inconvenience of polymorphism”.
I know there are people how outright oppose any OO for this very reason. In fact this was also the reason why in .Net methods are, unlike in Java, by default NOT overridable.
If you search on google for polymorphism breaks encapsulation or inheritance breaks encapsulation you will find lots of discussions on that topic.