Skip to Content
Object Design Style Guide
book

Object Design Style Guide

by Matthias Noback
January 2020
Intermediate to advanced
288 pages
6h 45m
English
Manning Publications
Content preview from Object Design Style Guide

Chapter 8. Dividing responsibilities

This chapter covers

  • Making a distinction between read and write models
  • Defining separate repositories for read and write models
  • Designing read models for their specific use cases
  • Building up a read model from events or a shared data source

We’ve looked at how objects can be used to retrieve information or perform tasks. The methods for retrieving information are called query methods, and the ones that perform tasks are command methods.

Service objects may combine both of these responsibilities. For instance, a repository (like the one in the following listing) could perform the task of saving an entity to the database and also retrieving an entity from the database.

Listing 8.1. PurchaseOrderRepository ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Object Design Style Guide

Object Design Style Guide

Matthias Noback
Design It!

Design It!

Michael Keeling
The Art of Clean Code

The Art of Clean Code

Christian Mayer

Publisher Resources

ISBN: 9781617296857Publisher SupportOtherPublisher WebsiteErrata PagePurchase Link