Often when I write a functions I want to make sure the inputs to it are valid in order to detect such errors as early as possible (I believe these are called preconditions). When a precondition fails, ...
I'm a fan of using assertions in the code to check for preconditions. The question is whether is it wise to use assertions in public methods to check the precondition? My personal opinion is, that if ...
Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs. The main differences are that asserts function as sanity checks and see real inputs, whereas unit ...
I recently came across some newly written code that was interspersed with lots of Debug.Assert (C#). Should we still use this widely despite the usage of TDD, BDD and Unit Testing in general?
About duck typing: Duck typing is aided by habitually not testing for the type of arguments in method and function bodies, relying on documentation, clear code and testing to ensure correct use. ...
I stumbled upon an article named Programming With Assertions. And beside the mechanism of turning on and off assertions after compile time, I don't get it. Why were assertions introduced on language ...