Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree with your conclusions but for different reasons.

Defensive programming "done right" should be self documenting ("oh, I see this routine requires this parameter to be non-zero"), and throw exceptions back up to the ui/app layer so that unmet assumptions can't be ignored by the app programmer.

For many-layered code bases, there needs to be a level below which data is assumed to be valid and can go unchecked (at least in release builds) - otherwise a single check will be performed many times from a single high-level call.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: