Code: Select all
public void openSocket(int port){
assert port > 1000;
...
}
It's not wrong to do assert on the parameter of a public method. I ran it and found no problem.Input params of a public method should not be validated using assertions.
You are simply suggesting that It's just not a good practice to do so.
Is that correct?
If so, why is it a bad idea?
Thanks.
Schmichael