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

Please correct me if I'm wrong, but would a precondtion not just be the postcondition of the setup?

Invariants would either have to be publically available and thus easily testable with similar methods, or, one would have to use assertions in the implemention.

I try to avoid the latter, as it mixes implemations and 'test/invariants'. Granted, there are situations (usually in code that implements something very 'algorithm'-ish) where inline assertions are so useful that it would be silly to avoid them. (But implementing algos from scratch is rare in commercial code)



assertions are basically comments with teeth; why would you avoid them in any code, algorithmic or no?




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

Search: