News for hackers. Stuff that matters.
Re:Ruby style guide by adelle on Wednesday April 15, 2009 @08:01AM (#563324)
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.

There are no comments on this comment yet.