In a traditional MVC application, which component (model, view, or controller) is responsible for reading/writing the model to/from disk?
The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application.
-MVC is an architectural pattern consisting of three parts: Model, View, Controller. Model: Handles data logic. View: It displays the information from the model to the user. Controller: It controls the data flow into a model object and updates the view whenever data changes.
A controller is responsible for controlling the way that a user interacts with an MVC application. A controller contains the flow control logic for an ASP.NET MVC application. A controller determines what response to send back to a user when a user makes a browser request.
Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction.
Short answer: model layer.
Most of the forms of storage are part of model layer (with exception of templates and autoloader for class). In a fully realized mode layer you would have a group of objects which are directly interacting with low level storage (SQL, cache, REST API, noSQL, file system, etc. ) abstractions.
If you application is actively reading and writing to the filesystem (it could be actually mounted remote MemoryFS, which you mounted via Fuse through SSH tunnel .. it does not matter), this would be handled by structures, which deal with storage logic. Usually some form of data mapper (thought it also might be repositories, units of work, DAOs and/or some similar structures).
The storage abstraction are usually responsible for storing data from and retrieving data into the domain objects. In a large scale application this interaction between domain objects and storage logic structures is contained within services to isolate the application and domain business logic from leaking in the presentation layer.
MVC
is typically a presentation layer framework, which comes at the top in Presentation based applications. In real enterprise applications, you may have several layers below it.
Typically this is done in another layer: You may name it as Business Layer
or Service Layer
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With