The Basic Architecture as Model-View-Controller (MVC) – Salesforce Fundamentals and Architecture – Salesforce Certified Platform Developer I Study Guide

1.1  The Basic Architecture as Model-View-Controller (MVC)

Salesforce is a cloud-based platform that provides customer relationship management (CRM) services to businesses of all sizes. Its architecture is based on the Model-View-Controller (MVC), which separates the data, business logic, and presentation layers of the cloud application. The platform is known for its flexibility, scalability, and customization options. Let’s break down the basic architecture of Salesforce, including MVC, multi-tenant environment, and capabilities.

The Model layer refers to the data model consisting of objects, fields, and relationships. Objects represent different types of data, for example, leads, contacts, and accounts. Fields define the attributes of those objects, and relationships establish how different objects are connected to each other, for example, by lookup or master-detail relationships. The Salesforce platform as a component-based framework uses a Salesforce cloud database behind, which is optimized for storing and retrieving data quickly and efficiently. The Salesforce platform allows developers to create custom objects and fields to store data specific to their business needs.

Let’s say you’re building a custom CRM application in Salesforce. You might create a custom object called “Project__c” to store information about your clients. You can define various fields within this object, such as “Project Name,” “Address”, “Project Number,” and “Project Source.” This object definition is part of the Model layer, as it defines the structure of the data you’ll be working with.

The View layer in Salesforce refers to the user interface (UI) layer, where users interact with the data in Salesforce platform where reusable UI elements can be combined to create complex interfaces. Lightning Web Components is an advancement of the Lightning Component framework, utilizing modern web standards such as CSS, JavaScript, and HTML. It makes better performance, reusability, and compatibility with other web technologies. The Lightning Design System (SLDS) provides a set of CSS frameworks and design guidelines to ensure consistent branding and user experience across all browsers and mobile applications.

Salesforce generally provides a customizable user interface that allows you to create custom page layouts. These layouts determine which fields are shown, their order, and their formatting. By customizing page layouts, you can tailor the way data is presented to different user profiles and record types. This flexibility allows for a more personalized and efficient user experience within the browser interface.

Salesforce Mobile App provides a mobile-friendly interface for accessing Salesforce on smartphones and tablets. The mobile app interface includes features like responsive layouts, touch gestures, and offline access. It is optimized for smaller screens and touch interactions, providing a seamless and intuitive experience for users on mobile devices.

The Controller layer in Salesforce refers to the business logic layer, where application logic responsible for handling user interactions, processing data, and coordinating

the flow of information between the model and the view is implemented. Salesforce provides a set of declarative tools to create logic and automation without the need for coding. Developers can also use Apex, a Java-like programming language, to create custom code to implement more complex business logic.

By executing logic, for instance, you have a requirement to automatically convert a Lead into an Opportunity when certain conditions are met. The Controller layer would handle the logic to create the Opportunity record and associate it with the relevant data from the Lead. Controllers can also be used to integrate Salesforce with external systems. If your application needs to communicate with an external REST API, you might implement the logic to make HTTP Callouts, receive and process the response, and update Salesforce records based on the external data.

Figure 1-1.  Model-View-Controller architecture