If your main interest is only writing short demo scripts, you could just use the Connection class discussed in the previous section. However, it is a best practice to wrap actual database access into a domain or service component. The domain is where the business logic is placed. In this context, business logic would include database access methods that allow us to perform critical database tasks such as adding to the database, making updates, removing documents, and performing queries.
For the purposes of the book, we rely on the of the Action-Domain-Responder (ADR) software design pattern (https://github.com/pmjones/adr). It is a newer design pattern that provides much-needed refinements to the more traditional Model-View-Controller (MVC) design pattern (https://web.archive.org/web/20120729161926/http://st-www.cs.illinois.edu/users/smarch/st-docs/mvc.html).
We will start our discussion with a domain service that represents the products collection.