Free Salesforce Admin Tutorial >

Chapter 13 - MVC Architecture >

MVC Architecture in Salesforce

MVC Architecture in Salesforce

What You’ll Learn


S2 Labs

Salesforce MVC Architecture 

Model View Controller (MVC) Architecture in Salesforce is a software pattern that separates the representation of information from the user’s interaction with it.

Salesforce MVC Architecture

Features Of Salesforce MVC Architecture

  1. We can write our VIEW pages using SFDC visual force (VF pages).
  2. Each VF page is associated with a Controller.
  3. We can make use of already-built Standard controllers(like Account, Contact, etc) or we can write our controller using Apex language. Apex is Object Orientated(proprietary Language of Salesforce) and very much similar to JAVA.
  4. We can also write Model Classes using Apex.

Modules In Salesforce MVC Architecture

MVC architecture in the Salesforce pattern contains three modules:

Implementation Of Salesforce MVC Architecture

Model (Database Layer)

The schema and data in Salesforce use 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. (sObjects are any objects that can be stored in the Salesforce platform database). It is a data model for all the objects which helps us to know about the relationship between them and each of their fields.

View (User Interface Layer)

How the schema and data are represented. Visualforce is used to present the data to users. It means how the UI will look like.

Controller (Business Logic Layer)

How the interface actions. Controllers are used to perform the actions whenever users interact with visual force. It contains all the business logic that helps us to communicate with the database from the UI. for example, apex Classes.

In SFDC:

  • Visual Force pages, Page Layouts, and Tabs come under the View Layer of Model View Controller in Salesforce.
  • Workflows, Apex Classes, and Triggers come under the Controller part in the Model View Controller in Salesforce.
  • Objects, Fields, and Relationships come under the Model Layer of the Model View Controller in Salesforce.

salesforce developer training

Benefits Of Using Salesforce MVC Architecture 

1. Reliability 

The layers have clear separation so it allows greater reliability if we want to change any layer. For example, it can change the look and feel of an application without recompiling the Model or Controller code.

2. High Reuse And Adaptability

MVC provides multiple types of views all accessing the same code.

3. Very Low Development And Life Cycle Cost

It makes it possible to have lower-level programmers develop and maintain user interfaces. Development time can be significantly reduced because Controller programmers focus solely on transactions and view programmers focus solely on presentation.

4. Easy To Maintain

The separation between layers makes it easier to maintain, test, and deploy apps.

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Comments
  • Qaznardevolo 21 Mar, 2023 at 1:40 pm

    interesting for a very long time

  • Qazzyirome 25 Mar, 2023 at 10:22 pm

    Thanks, I’ve been looking for this for a long time

Post a Comment

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