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
Assertions in Production Code?
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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.
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.
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: