Understanding the Operation Result Design Pattern
This chapter explores the Operation Result pattern, starting simple and progressing to more complex cases. An operation result aims at communicating the success or the failure of an operation to its caller. It also allows that operation to return both a value and one or more messages to the caller.
Imagine any system in which you want to display user-friendly error messages, achieve some small speed gain, or even handle failure easily and explicitly. The Operation Result design pattern can help you achieve these goals. One way to use it is to handle the result of a remote operation, such as after querying a remote web service.
This pattern builds upon foundational object-oriented programming concepts. Having a whole chapter about it allows us to iterate and design different possibilities incrementally. Of course, the final design should always be based on your needs, so learning multiple options should help you make the right...