Does the following pattern have a name?
- every function returns an instance of a
resultclass (or structure, or associative array) that has at least these two public variables:success: a true/false value to hold if the action completed successfullyresult: a variable that holds the result of the function or nothing if the function is void.
- if
successisfalseanerrorvariable may hold information (exception/stack trace/debug) about the error - also a
messagevariable holding an user friendly message was defined in one case
I've seen this used both in .Net and PHP (both internally and in a script invoked by javascript ajax requests).
Aucun commentaire:
Enregistrer un commentaire