MVC pattern in simple words....

MVC pattern was introduced to the developers years back when monolithic applications were being built. Main aim of this pattern was to break up the monolithic application into pieces.Divide and rule always works :).

what are the disadvantages of Monolithic application:

 1) Hard for multiple developers to work on the same project.Thus increasing the delivery time.


2) small changes to the code leads to replacing the whole application on the client machine.

3) duplication of the same code across multiple applications.
 
 MVC pattern stands for MODEL VIEW CONTROLLER pattern. MVC breaks the application into 3 different pieces.

VIEW : This includes UI. Forms / Dialog boxes/ grid, etc. Programmers can place all the UI elements into a separate DLL or package.These packages can also be called as satellite assemblies. Take care that you don't write any code to handle UI events.


CONTROLLER: This include code that handles events from the VIEW package. Such as , mouse events  and key board events.It also controls the flow of User control on the UI. This should not include any Business logic . Because , business logic does not change that often and can be reused by multiple other components  in the project. Importantly, those components don't care about the UI event handling code present in the controller.So, it makes sense to remove business logic out of controller.

MODEL: This includes code (Data access objects) to get business data from the database/ XML file .This module includes business logic and can be reused by other controllers.Model does not care about the UI. It responds back to any requests from the controller.

How does the whole thing work?

Controller loads the view module and handles UI events and controls the flow of UI. Controller requests the Model for any data to be shown on the view and saves the data (entered by the user in the UI) into the database via Model .

See .... that's so simple...
Ebook Download
View all
Learn
View all