DEV Community

[Comment from a deleted post]
Collapse
 
florianschaetz profile image
(((Florian Schätz)))

In my (limited) experience, defensive programming mostly enables you to fail gracefully instead of disastrous, but often (unless you write much redundant code, which is perhaps a way for really critical software) you will not be able to complete successfully. I can, for example, prevent my service from crashing down with a null pointer, but I still cannot guess what the correct input might have been instead of "null". I can determine that the time seems off somehow, but I still cannot guess what the correct time is. I can determine that the speed doesn't match normal parameters (because it's given in quarter nautical miles per coffee break instead of miles per hour), but I cannot guess what the correct speed actually would be.