if I have a function like
public void usefulUtility(parameters...) {
string c = "select * from myDB";
do_a_database_call(c);
}
that's used in alot of places, is there any possible harm in changing it to:
public bool usefulUtility(parameters...) {
string c = "select * from myDB";
bool result = do_a_database_call(c);
return result;
}
Could this possibly break any code?
I can't think of anything... but it may be possible?
Yes, virtually anything that you could possibly do that affects your public interface is a breaking change. It could be small enough that you don't care, and that nobody, or almost nobody, will actually happen to hit the corner cases, but Eric Lippert explains that there are edge cases (many of which involve Type inference) that can cause even these seemingly innocuous changes to break.
For your particular example, this code would be broken by that change.
Action a = usefulUtility;
A change like this could definitely break stuff, both in terms of binary compatibility and in terms of source compatibility.
You might want to have a look at this StackOverflow answer and its associated thread, where API-breaking changes are discussed in depth.
It's certainly possible that it could break some other code. As Lippert points out, nearly Every public change is a breaking change in some bizarre situation.
The more important question is, is it likely to cause anything to break, and the answer is no. You should be pretty safe making this change, because people aren't likely to do the bizarre kinds of things they would have to do for this to cause problems. That doesn't mean it's impossible to break some other code, but it's outside the realm of reasonable responsibility.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With