Salesforce Tutorial# 12: Visualforce MVC Architecture on Cloud

MVC is one of the widely used software architecture design pattern which divide the design in three basic components i.e. Model, View and Controller. Salesforce provides Visualforce an interface to quickly develop applications following MVC architecture over the cloud.

In Visualforce you can implement MVC using standard as well as custom objects. Also you can implement MVC using 3 newly introduced Salesforce objects pages, components, and controllers.

These pages work like JSP or ASP pages and give the best presentation as per user need. Each View has associated controller. Developer can use some standard controller or can write their own using Apex programming language.  VF also has auto generated controllers to make interaction with databases.

Fig 12.1 MVC architecture


The database objects in Salesforce are known as Data Model. It consists of the standard Salesforce objects like Accounts, Contacts, Opportunities, and Leads etc. It also support any custom objects created as per customer requirement. What kind of schema should be use and what kind of data should be use to represent that is decided here. We can consider the example of sObjects as Model in saleforce. As every entity is mapped to some sObjects.

Field, Object and Relationships come under the Model section of MVC architecture.


The presentation of information to the user is nothing but the View. This is one user interface given to user for interaction with system.  View consists of visual salesforce pages and components. Pages may be linked with Visual force components. These pages use HTML for preparing layout of application. To refer each page it is linked with unique URL similar to web pages.

Components – The reusable code or block of code is named as component. These components can be styled with CSS and are reused whenever necessary.

Visual force pages, tabs and Page layout classes come under the View.


The business logic is implemented in controller. These are the building blocks of the actual logic using Apex language. The pages from the view interact with controller using components. Salesforce has pre-build controller for some standard actions like save, Edit etc. Workflow, Triggers and Apex classes comes under this layer.

Fig 12.2 Salesforce MVC Pattern Ref:

This is basic introduction to Visualforce MVC and how it is an integral part of Salesforce. Please stay tuned for more informative articles on Salesforce.

If you need to refer other Salesforce related information please feel free to navigate using below index

Tutorial Index

  1. Introduction to Cloud Computing ( and
  2. Overview of Database Concepts (
  3. Introduction to
  4. Building Salesforce Custom App and Objects
  5. Object Relationships and Formula Field in Salesforce
  6. Salesforce Security Model and Overview
  7. Automation in Salesforce
  8. Approval Process in Salesforce
  9. Introduction to SOQL and SOSL
  10. Introduction to Apex
  11. Salesforce Data Management
  12. Visualforce MVC Architecture on Cloud
  13. Salesforce Reports and Dashboards
  14. Building a Visualforce (Custom) Page for the Salesforce App
  15. Salesforce Sandbox and Overview of capabilities
  16. Learning Apex and Deployment Tools

Add a Comment

Your email address will not be published. Required fields are marked *