Apex code is a strongly typed programming language that

executes on the platform. Apex is used to add business logic to applications,

to write data base type triggers, and to program controllers in the user interface layer. It

has a tight integration with the data base and query language, good web service support,

and includes features such as futures and governors for execution in a multitenant


- Integrated with DML, Inline, SOQL and SOSL and holds the ability to do bulk processing.

- Data focused.

- Hosted by the platform and knows multitenancy.

- Automatically upgradeable.

- The architecture is the same for developer and End user perspectives.


Advantages of Multitenancy:

Low cost.

Single set of Hardware Resources.

User satisfaction.

Improved Quality.

Customer Retention.

Collaboration and Integration.

Error Free.

Easily Customizable and Upgradable.


When should we use Apex:

Create Web Services.

Create Email services

Perform complex validation over multiple objects.

Create complex business process that are not supported by workflow.

Create custom transactional logic.

Attach custom logic to another Application.


How does Apex work?

All Apex runs entirely on demand on the platform, as shown in the following architecture diagram.




The above diagram describes about the Apex compiled, stored and run entirely on the platform.

- When a developer writes and saves Apex code to the Platform, The platform application server first compiles the code into an abstract set of instructions that can be understood by the Apex run time interpreter and then saves those instructions as Metadata.

- When an end user triggers the execution of Apex, perhaps by clicking a button or accessing a Visual force page the platform application server retrieves complied instructions from the Meta data and sends them through the runtime interpreter before

running the result.

The end user observes no differences in execution time from standard platform requests.

Check out our Related Courses

Salesforce Tutorials

SalesForce Interview Questions & Answers

Annotations in SalesForce

Loops in SalesForce

Apex Data Manipulation

Creating Apex Classes

Salesforce Training In Hyderabad