Assertions in Production Code?

Post Reply
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Assertions in Production Code?

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

James,

yes, I fully agree with you
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply