Apex

Force.com Apex code is a strongly typed programming language that executes on the Force.com platform. Apex is used to add business logic to applications, to write database type triggers, and to program controllers in the user interface layer. It has tight integration with the database and query language, good web service support, and includes features such as futures and governors for execution in a multitenant environment.

  • Integrated with DML, Inline, SOQL and SOSL and holds the ability to do bulk processing.
  • Data focused.
  • Hosted by the Force.com platform and knows multitenancy.
  • Automatically upgradeable.
  • The architecture is the same for the developer and End-user perspectives.  

Advantages of Multitenancy

  • Low cost.
  • A single set of Hardware Resources.
  • User satisfaction.
  • Improved Quality.
  • Customer Retention.
  • Collaboration and Integration.
  • Error Free.
  • Easily Customizable and Upgradable.  

Inclined to build a profession as SalesForce Developer? Then here is the blog post on, explore SalesForce Training

When should we use Apex:

Create Web Services.

Create Email services Perform complex validation over multiple objects.

Create a complex business process that is not supported by the workflow.

Create custom transactional logic. Attach custom logic to another Application.  

How does Apex work?

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

  introduction to Apex  

The above diagram describes the Apex compiled, stored and run entirely on the Force.com 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 trigger the execution of Apex, perhaps by clicking a button or accessing a Visual force page the platform application server retrieves complied instructions from the Metadata and sends them through the runtime interpreter before running the result. The end-user observes no differences in execution time from standard platform requests.

 

Salesforce Tutorials

 

Check out our Related Courses