The model is not
You have code that reflects the model,
and it contains words that come from the
But code is just an implementation of
the model. The model exists in the mind
of the developer.
The model is not
Some of the data associated with the
model is in the database. And the
database schema is another
implementation of the model.
But the model encompasses all of the
domain logic AND data, and it exists in
the mind of the developer.
The model is not a
A diagram is just a picture of the model.
The model itself exists in the mind of
CitationService.formatBook(string title, CiteStyle style)
1. Call the WorldCat API to get publication info about the book.
2. Pass the WorldCat response object to BookFactory.fromWorldCat()
3. For analytics, pass the Book object to BookRepository and call
4. Using the name of the CiteStyle, pass the Book to a ViewFactory
for formatting and return the View.
Some Benefits of Repositories
• A repository is an interface, so you can read and write persistent
data without knowing where it’s going. You can say repository.read()
and it might read from a REST API, web sockets, local storage, or
• That’s why a repository is called a Persistence Abstraction Layer.
Objects in one layer can refer to objects in any lower layer.
Objects in one layer can refer to objects in that same layer.
Objects in one layer CANNOT REFER TO OBJECTS IN A HIGHER LAYER.
Let’s Get Some Practice
For some more good reading, go to http://www.loewenbraeuzelt.de/wp-content/
Or check out Eric Evans’ Book, Domain Driven Design
In This Presentation
• See the working app: cornellnotes.nodejitsu.com
• GraphJS: https://github.com/cameronprattedwards/graphjs
• entity-context: https://github.com/cameronprattedwards/entity-context