3 ms·
From this same argument, a connection to a database by definition is outside the scope of your domain because it is also outside of your application, and that y
by saurik 15y ago
From this same argument, a connection to a database by definition is outside the scope of your domain because it is also outside of your application, and that you should instead have something like a Command or Job that accesses the database storage backend and updates it, thereby placing the database outside of the scope of the model.
The goal of the "model" in MVC is to build an in-application model of outside-application (possibly "real world") state, whether it be a tree of browser bookmarks in folders or a tree of files in filesystem folders or a tree of reports in a command hierarchy; as your application needs to be able to understand these things, it needs to model them.
In an ideal world, your model presents a reasonably abstract rendition of the thing that you are modeling (so that you will be able to reuse views and controllers for anything that is sort of tree-like), however you may also be modeling something very particular to your application, in which case you will have a rather convoluted one-off model.
Now, to be clear, I'm not disagreeing with your suggestion of how to structure the logic of your application: having a bunch of data that is manipulated by connections to external systems can make a lot of sense; however, when "domain oriented design" is talked about, AFAIK the entire purpose is to decide how to internally structure your model, taking it as a given that, from an MVC perspective, that is where all of these behaviors and state are supposed to be kept.
http://blog.fedecarg.com/2009/03/11/domain-driven-design-and-mvc-architectures/ http://blog.fedecarg.com/2009/03/11/domain-driven-design-and...
> Domain-driven design separates the model layer “M” of MVC into an application, domain and infrastructure layer. The infrastructure layer is used to retrieve and store data. The domain layer is where the business knowledge or expertise is. The application layer is responsible for coordinating the infrastructure and domain layers to make a useful application.