by ioquatix · 9y ago · 0 comments
For example, you can stub the repository and avoid persisting objects in tests, and only test persistence in the appropriate ones.
Or, you always know that operations you call on an entity won't touch the database, so you avoid a whole class of problems (think: accidental N+1 queries in a loop).
Or, by making the query interface private to the repository, you avoid accidental leakage of storage details (think: `default_scope` impacting associations)
I believe Ecto/Phoenix adopts a similar pattern http://www.phoenixframework.org/docs/models
Anyone have commentary on why one would use this over another more mature framework?
IMHO, if popularity was a concern, Luca should have opted for a batteries included nosql ORM/DB with seemless integration. Couchdb and MongoDB would have made excellent candidates.