How does MVC follow Separation of concerns?

Let’s start with explaining what MVC is.

MVC

In object-oriented programming development, 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. Model component corresponds to all the data-related logic that the user works with.

The View component is used for all the UI logic of the application.

Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output.

Separation of Concern

As per Wikipedia ‘the process of breaking a computer program into distinct features that overlap in functionality as little as possible’. Concern is a set of information, in our application concern is known as modules or a set of responsibility, we use this principle to separate application module to manage scalable applications.

Where do we see it in MVC?

Separation of Concerns (SoC) is about keeping components separate and MVC design pattern aims to separate content from presentation and data-processing from content. Modular programming is based on the idea of keeping the information and functionality of the program separated into modules; in MVC it’s recommended to use Model for business logic, Controller for processing incoming requests and Views to display information to end user.

Keeping the components separate has a myriad of benefits. A good program that represents SoC well can have each of the sections reused, and updated and developed independently of each other.

Written on June 27, 2017