Upload
al-sayed-gamal
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
Assertions
What’s assertion ?!
Make sure that your language fails on assertion error.!
When is the most suitable time to do assertion.!
Assertion doesn’t conflict with logging.
13
–Jim Shore
“However, it’s tough to know when to add assertions. One way to tell is to look for comments.”
16
23
and even better
If the maxConnections wasn’t found or mistyped it will throw!something like this one:
Summary
Don’t fail silently and save your time and out time.!
Assert whenever you comment.!
Assert.notNull(_instanceVariable).!
Fail with description.!
Use a global handler for users sake.
25
References
http://www.martinfowler.com/ieeeSoftware/failFast.pdf!
en.wikipedia.org/wiki/Fail-fast
26