Chapter 6. Retrieving information
This chapter covers
- Using query methods for retrieving information
- Using single, specific return types
- Designing an object to keep internal data to itself
- Introducing abstractions for query calls
- Using test doubles for query calls
An object can be instantiated and sometimes modified. An object may also offer methods for performing tasks or retrieving information. This chapter describes how to implement methods that return information. In chapter 7 we’ll look at methods that perform a task.
6.1. Use query methods for information retrieval
Earlier, we briefly discussed command methods. These methods have a void return type and can be used to produce a side effect: change state, send an email, store a file, ...
Get Object Design Style Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.