Model View Controller
Jump to navigation Jump to search
The Model View Controller (also known as MVC) architecture is a method of organizing an application so that there is a distinction between the code that is responsible for the appearance of your application, the behavior of your application, and the content of your application. The structure is designed to where the inputs from applications work with the structure and content of an application but the structure and content of an application does not communicate or work together in an application.
The Model of a program would be the data and the logic of the program. The controller is the ‘middle-man’ between the model and the view. The view is the appearance of the application, which is created after the controller has received the necessary data to display to the user. The View represents the data visually and contains the functions that enable users to interact with a user interface. An example of this would be when you are customizing your desktop’s wallpaper to make it visually appealing. An important fact of this component is that it only demonstrates visuals given to it as instructions from the controller. There is no data logic being analyzed by the View as that function will already occur in the Controller. The Controller is the brains of the program. The only interaction between the Model and the View is through the Controller. Any user input is given to the controller which it translates into a request for the model to process. The controller then takes the data from the model and passes it to the view to display.
One example of a Model View Controller that you might be familiar with is Super Mario Bros. A model is data used in a game, so the actual data that represents the character Mario would be the model in MVC. The view is the visuals in Super Mario Bros. From the background to the platforms and designs of characters, the view would be the visual aspects of the game. The controller handles the inputs, so anything from a Wii Remote to a Switch Controller could be examples of the controller that helps the user interact with the game and make Mario move. All of these work together in order to make all the aspects of Super Mario work efficiently.
A paradigm is a model or pattern that can be used to represent a certain concept, Having a model to represent a universal concept allows a person to understand the inner-workings behind any application. In the case of the Model-View-Controller paradigm, you can use it to understand how code is managed in an application and how data is handled between the database, and how that data is visually represented via the communication between the two through a controller. These applications can range from being a website to a video game like Super Mario Bros to websites like YouTube. Overall, a paradigm sets the standards for an accepted idea (in this case, MVC).
Presented by Team Cambodia