"... If you look at the source of your program, you'll notice routines that you call, but which you didn't implement..." -- Peter Van Der Linden
Valstat is a software architecture paradigm. Valstat is not yet another error-handling idiom. More precisely valstat as a protocol, is a paradigm shift in unified logic of creating a call response and handling the payload returned.
OK, here you are. In the language you need to use, implement valstat as a light structure of two fields. The field in many business systems languages is option<T>
; it can be empty or occupied; when not empty it has a value of type T. Call the first field Value
and the second field Status
// VALSTAT pseudo code synopsys
{
option value
option status
}
you call the function and it returns such a structure. You use it in two steps:
- what is the call outcome?
- depending on the outcome what is the value (if any) or what is the status (if any)
The key is: that every interface method has to return valstat type. Everybody has to agree on the Valstat two-step usage. That also dictates how are valstats made. Everybody can be a team, a project, a system, a company, or wider than that. The wider the better. One can return valstat types using JSON, HTTP, XML, SQL, or whatever else.
valstat documentation is deliberately technical, short, and to the point. The prose is left to be authored in future texts in response to future criticisms, comments, and clarification requirements.
valstat concept is designed to be platform and language-agnostic.
There is a root document describing the core concepts. There is also a number of repositories describing the various implementations in a few widely used programming languages.
- valstat Concept
- The language agnostic, conceptual, root document
- c implementation
- planned ISO WG14 proposal
- c++ implementation
- javascript implementation
- c# implementation
- go implementation
Together a concept and its implementation are making a behavior pattern.
In case you still like to use exceptions, here is the latest C++ official paper on the cost of exceptions in C++.
In case you hotly dislike this work, or if the situation is the opposite, or there is anything else you wish to communicate on the long scale in between these two extremes, please do not hesitate to contact the author:
(c) 2019, 2020 by dbj at dbj dot org