The Operation Result pattern
The Operation Result design pattern can have a very simple or complex implementation, depending on how much information you want the operation to return to its caller. In this section, we explore multiple ways to use this pattern. We start with its simplest form and build on that until we can return messages and values and add severity levels as the result of an operation.
Imagine any system where you want to display user-friendly error messages, achieve some small speed gain by returning an object instead of throwing an exception, or even handle failure easily and explicitly. The Operation Result design pattern can help you achieve these goals.
One excellent use case is to handle the result of a remote operation, such as after querying a remote web service.
Goal
The role of the Operation Result pattern is to give an operation (a method) the possibility to return a complex result (an object) that describes whether the operation was successful...