DEV Community

spencer-w-mathews
spencer-w-mathews

Posted on

MVC-What is it?

MVC is a software design pattern that separates the data, layout, and routes. This creates a division of labor or "separation of concerns" that allows for easier maintenance.

Model

The model decides what data the app should hold. If data changes then the model will tell the view.
In a rails/react application the models would be located within the app folder and they would be written in ruby.

View

The view is the screen of the app the decides which data to display.
In a rails/react application this would be the react portion. The front-end which displays the data to the end-user.

Controller

The controller possesses logic with the ability to update the models and/or view in response to actions from the end-user.
In a rails/react application the controllers would be located within the app folder and they would be written in ruby.

Image description

sources: https://developer.mozilla.org/en-US/docs/Glossary/MVC

Top comments (0)