17
votes
10answers
4k views

Should a method validate its parameters? [duplicate]

Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How ...