Урок 2

Programming Models, Validation and "Continuable" Errors

In writing software, there are two models for validating inputs.


  • Fail on First Error
  • Report All Errors
The first model assumes that an invalid input should halt processing, and be handled by some sort of error handling routine.  The second model assumes that it's better to continue, finding and reporting as many errors as possible to enable correction of all errors.

The first model is completely applicable in production environments, and is supported in programming language constructs by throwing and catching exceptions.  

The second model is applicable when performing validation testing, and enables reporting of not just the first, but all applicable errors found.  The FHIR OperationOutcome resource supports this model of error reporting.

Ancient software source code compilers USED to work the first way, but modern ones report as many errors as they can to enable software developers to correct as many of these errors as they can before trying again.

It makes me wonder if there shouldn't be a programming language construct to support the queuing of exceptions in some way.  


If I go back to modern compilers, and think about how they are able to continue, there's an error handling component that 
a) flags that an error has occurred to ensure that executable code isn't generated (at least at the location of the error ... the Java debugger can still execute classes and methods that contain compile errors in it), and 
b) "corrects" the input making reasonable assumptions to enable continuation of compilation.

Some things to consider in the construction of a construct to handle continuable errors:


  1. What are the boundaries for queuing and reporting of such a "continuable" error and how would these be set in a software application?
  2. What should happen if some OTHER error was detected that may have been a result of a continuable error?
  3. How would you ensure that software could continue to run after it detected one of these "continuable" errors.
I don't have an idea about how this would look, I'm just thinking about how it would make some jobs easier.

     Keith


[fixed][/fixed]