Chapter 7. Performing tasks

This chapter covers

  • Using command methods to perform tasks
  • Using events and event listeners to split up larger tasks
  • Dealing with failure in command methods
  • Introducing abstractions for commands
  • Creating test doubles for command calls

Besides retrieving information from objects, you can use objects to perform a variety of tasks for you:

  • Send a reminder email
  • Save a record in the database
  • Change the password of a user
  • Store something on disk
  • And so on . . .

The following sections provide rules for methods that perform tasks like these.

7.1. Use command methods with a name in the imperative form

We already discussed query methods and how you should use them to retrieve information. Query methods have a specific ...

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.