Page 1 of 1
Assertions in Production Code?
Posted: Thu Sep 04, 2008 12:35 pm
by James Bott
This is an interesting article.
Assertions in Production Code?
http://dobbscodetalk.com/index.php?opti ... &Itemid=29
I must confess that I have been very lax in using assertions. I am considering spending more time on it.
Comments?
Regards,
James
Posted: Thu Sep 04, 2008 1:12 pm
by Antonio Linares
James,
Lets make a comparison with the security of a house:
You can place gates, security windows, alarms, security guards, etc. but will it be 100% totally safe ? Wouldn't there be a way to bypass all that security ?
I mean that we can minimize the risks as much as possible, but there will always be a failure percentage.
Posted: Thu Sep 04, 2008 1:44 pm
by James Bott
Antonio,
Oh, I agree. But some of the comments like:
>Professionally written production code is bug free, so there is no need for asserts.
>An assert firing causes the program to abort, which may not be permissible, may cause data loss, and looks unprofessional to the customer.
Really surprised me. That is just ignoring that there can be problems.
I think we need to find an acceptable middle ground. This point will vary depending on the consequences of the software failing.
James
Posted: Thu Sep 04, 2008 7:41 pm
by Antonio Linares
James,
yes, I fully agree with you