Patterns Requiring Knowledge of References

Part VI contains programming patterns that require an understanding of objects and references, and parameter passing. Specifically, this part of the book contains the following programming patterns:

Chained Mutators. A solution to the problem of invoking multiple different methods on the same object, one right after another.

Outbound Parameters. A solution to the problem of needing to return multiple pieces of information from a single method.

Missing Values. A solution to the problem of distinguishing missing values from actual values so that they can be handled differently when performing calculations of various kinds.

Checklists. A solution to the problem of checking to see whether a specific set of criteria (identified at run-time) have been satisfied.

The chained mutators pattern involves the return of a reference, while the outbound parameters pattern involves passing references. The missing values pattern takes advantage of the “special” reference null. Finally, the checklists pattern is a generalization of the bit flags pattern that allows for the set of criteria to be created dynamically (i.e., at run-time).

License

Icon for the Creative Commons Attribution 4.0 International License

Patterns for Beginning Programmers by David Bernstein is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book