Are MVC & 3-Tier Architecture the Same Thing?

The MVC design pattern is sometimes mistaken for the 3-Tier architectural pattern.

Are MVC and 3-Tier the Same Thing?

•  MVC was developed in the late 70s for desktop apps by Smalltalk developer Trygve Reenskaug.

•  3-Tier architecture was developed in the early 90s by MIT professor John Donovan.


MVC & 3-Tier evolved separately and at different times. They are different things.


Is the Application Data Model the Same as the DB Data Model?

•  When a program prompts a user to save his changes, is the data in the database? Obviously not. So, is the database the application's model? Obviously not. After the user makes changes to fields displayed on the screen, the program's copy of the data is out of sync with the database and saving will update the database with the changes made by the user.

•  When a user elects to undo changes he has made, where are the versions of the data? Has anyone ever implemented undo and redo in the database? Undo and redo are not performed in the database. Undo and redo are performed on data in the application's memory (in OO, the domain model).

•  If you migrate your data store from DB2 to MongoDB you will have to modify the application's data layer to process Mongo's JSON instead of SQL's result sets but the model itself and the code in the MVC implementation won't need to change. MVC is independent of data access and data store.

•  Although developers often speak of a data model in the DB, it is not the same model as is in program memory. You can find many examples of Domain Model POJOs (plain old Java objects) by searching online. Domain model POJOs aren't coded in SQL.

•  MVC is used in the front end of email, system management dashboards and drawing apps, none of which have a relational DB data store. The objects used in the email or drawing app aren't coded in SQL so, the model in MVC isn't a DB model.

Is There Data Access in MVC?

•  You only have to look at Microsoft's frameworks to see that the presentation framework ASP.Net MVC is completely separate from Microsoft's database access solution, ADO.Net Entity Framework. We conclude therefore that the application cannot use the .Net MVC framework for data access and requires the Entity framework or similar component to perform that work.

•  MVC tutorials freely available on the web show nothing about interacting with the database. MVC is independent of the data store.

•  Database IO design patterns such as DAO have nothing to do with MVC since MVC has nothing to do with the database.

•  The 1st image below shows interaction in the MVC components.

•  The 2nd image shows 3-Tier architecture which is composed of totally different things.

   


Blog Archive