MVC Architecture – GUI or Domain Architecture?

Architecturedesign-patternsmvcobject-oriented

Fowler refers to the MVC, as a GUI architecture:

There have been many different ways to organize the code for a rich client system. Here I discuss a selection of those that I feel have been the most influential and introduce how they relate to the patterns.

If MVC is a GUI architecture, then say that the M in MVC are the business rules or domain is not wrong?

Best Answer

MVC was originally designed to solve the problems in architecting GUIs. It decouples the process of extracting data from the model in order to present it from the process of presenting it. Basically it is an application of the Single Responsibility Principle to GUIs.

This has a number of large advantages: it takes away the need to have logic code from the presentation layer and it makes the controllers testable, thereby increasing quality and reliability. Early web GUIs, like classic ASP, had logic code embedded in HTML pages which was hard to maintain and just made you feel dirty.

The Model is basically a black box representing the application and its data, and will typically be an n-tiered application. The View is to display the data from the application and typically pass commands and data back to update the application. The Controller mediates between the Model and the View, presenting data to the View and commands to the Model.

So the Model is, as you say, the business rules or domain (or it could just be a database), but the entire architecture - Views to present data and Controllers to pass data and commands back and forth between the Model and the Views - is very much a GUI framework.