Back

What is MVC style ?


The MVC style is a way to simplify the relationship between each role by dividing the application into three role parts: Model, View and Controller.

Model: Role of the model

  • It is the target (target data) of the purpose handled in the application, and corresponds to as if actor or prop in the stage called an application.
  • The target data is managed in a database (data storage), so the model plays the role of linking with each data resource of the database.
  • The data or collection of data handled by the application is processed through the role of the model.
  • In other words, the model is treated as a virtual representation of the data retrieved from the database.
  • Specifically, if you sell products, the model is the product, the customer who buys it, etc. In SNS, it is the “person”, the “message” that is related with each other.

View: role of view

  • Plays the role of the user interface where the user interacts with the application through the screen.
  • Views are used to present data from the application to the user in an easy-to-understand screen design, and to mediate the interaction between the user and the application, such as the screen where the user inputs data.

Controller: Role of the controller

  • The controller receives a request from the user and works with the model to play the role of leading the processing intended by the user.
  • When the controller needs to interact with the database in the process of leading the process, it does so by giving instructions to the model along with the data received from the user.
  • The controller also directs the processing results to the view to provide the requested information to the user.
  • The controller is the part that deals with the very functionality that you actually want to service. Specifically, if products are treated as a model, it means the product management group that registers new products and changes them , or the order management group etc.

By creating an application with MVC role separation, each role in the application can be configured in a simple and easy-to-understand manner.
Separating into MVC is also very useful for improving and adding functionality to your application. Work such as improvement becomes smooth without worrying about the influence of other targets and features.
In addition, various user interfaces that will be adopted by users in the future can be considered separately from processing such as a database.

Back