Model View Controller (MVC)


Model view controller (MVC) is a software architecture pattern which separates the representation of information from the user’s interaction with it

In addition to dividing the application into three kinds of components, the MVC design defines the interactions between them.

controller can send commands to its associated view to change the view’s presentation of the model (e.g., by scrolling through a document). It can also send commands to the model to update the model’s state (e.g., editing a document).

model notifies its associated views and controllers when there has been a change in its state. This notification allows the views to produce updated output, and the controllers to change the available set of commands. A passive implementation of MVC omits these notifications, because the application does not require them or the software platform does not support them.

view requests from the model the information that it needs to generate an output representation.

SFDC MVC: You can write your VIEW pages using SFDC visual force (VF pages). VF pages are similar to our JSP pages.  Each VF page is associated with a Controller. you can make use to already built Standard controllers or you can write your own controller using Apex language. Apex is OO and very much similar to our JAVA. you can also write Model Classes using Apex.

Visualforce uses the traditional model-view-controller (MVC) paradigm, with the option to use auto-generated controllers for database objects, providing simple and tight integration with the database. You can write your own controllers, or extensions to controllers, using Apex Code. Visualforce also provides AJAX components, and embeds the formula expression language for action, data and component binding interaction. is award winning tool to manage all the data of sales team of an organization. The flexibility and assurance of safe data provided by results into nonparallel development capabilities to the developer.

SFDC MVC pattern contains below three modules:

  1. Model
  2. View
  3. Controller

Model: What schema and data does salesforce uses to represent the system completely. In salesforce, we can say that sObjects are the model as every entity in salesforce is mapped to some sObject.

View: How the schema and data is represented. Visualforce is used to present the data to users.

Controller: How the interface actions. Controllers are used to perform the actions whenever users interact with visual force.


1. Visual Force pages, Page Layouts, Tabs comes under View Layer of Model View controller .

2. Workflows, Apex Classes, Triggers comes under Controller part in Model View controller .

3. Objects, Fields, Relationships comes under Model Layer of Model View Controller .

Like it? Share with your friends!