Program logic bugs vs input/environmental errors

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 09:23:40 PDT 2014


On Sunday, 28 September 2014 at 16:16:09 UTC, Sean Kelly wrote:
> On Sunday, 28 September 2014 at 00:40:26 UTC, Walter Bright 
> wrote:
>>
>> Whoa, Camel! You're again thinking of Exceptions as a 
>> debugging tool.
>
> They can be.  What if an API you're using throws an exception 
> you didn't expect, and therefore don't handle?  This might be 
> considered a logic error if the exception is recoverable and 
> you don't intend the program to abort from that operation.

Also, I think the idea that a program is created and shipped to 
an end user is overly simplistic.  In the server/cloud 
programming world, when an error occurs, the client who submitted 
the request will get a response appropriate for them and the 
system will also generate log information intended for people 
working on the system.  So things like stack traces and assertion 
failure information is useful even for production software.  Same 
with any critical system, as I'm sure you're aware.  The systems 
are designed to handle failures in specific ways, but they also 
have to leave a breadcrumb trail so the underlying problem can be 
diagnosed and fixed.  Internal testing is never perfect, and 
achieving a high coverage percentage is nearly impossible if the 
system wasn't designed from the ground up to be testable in such 
a way (mock frameworks and such).


More information about the Digitalmars-d mailing list