read-models

A bit like

talk-deconstructing-the-framework#what-to-put-in-the-activerecord-model

Watching it reminded me about how in Destroy All Software he has ActiveRecord classes provide an abstraction to the database and not much else, but the methods he does put in them are interesting.

The methods he adds are basic query or update methods that are named and take parameters.

So, objects that interact with the ActiveRecord objects can only call those methods and not the bazillion methods that ActiveRecord-subclassed models provide by default.

That narrows the interface and, makes it explicit about how to use it because you have to use those explicit methods, it and makes an easy point for stubbing or mocking.

 

but supposedly in DDD it's also used for handing events.

blog-post-read-models-as-a-tactical-pattern-in-ddd

Referring Pages

video-from-legacy-to-ddd