Apex Programming language
Apex Programming language is strongly typed and works on OOPS concept. It uses similar syntax that looks like Java and acts like database stored procedures. Apex enables developers to add business logic to most of the system events which include button click, page load, related record update etc.
Apex language is
- Easy to use
- Data focused
- Mutilated aware
- Easy to test
- Apex provides built in support for DML operations, including the exceptions
- Support SOQL and SOSL statements
- Loops operations to support bulk data
- Locking syntax to prevent from update conflict.
- Can build custom API from sored Apex methods
- Warning or error messages when a object or field which is used in Apex getting deleted.
Easy to Use
- Apex is like Java programming language.
- Uses Variable declaration syntax, expression syntax, loop syntax, object and arrays that are similar to Java.
- Apex adds new elements, all have easy to understand syntax.
- Easy to write
- Follow OOPS concept
- Can handle multiple queries and DML operations in a single transaction.
- Developers use database stored procedures to thread together multiple transaction statements on a database server
- Apex does not attempt to provide general support for rendering elements in the user interface.
- Apex is strongly typed language that uses direct reference to object or field names.
- Fails to compile if references are invalid
- All custom objects, fields and classes are stored in metadata so that they do not get deleted if there is any reference linking between them.
Apex is interpreted, executed, and controlled entirely by the Lightning Platform.
- As salesforce architecture is built on multitenancy, so is apex.
- To avoid monopolizing of resources, there are governor limits set on apex language as well.
- Limitation are set to the apex code size, method size, characters, file size of apex etc.
- Limitations are set for the code that is written in the apex and proper exceptions are also written.
Easy to test
- Provide built in support for unit test creating and execution
- Support include, test results that indicate how much code is covered, which part id more effective.
You can save your Apex code against different versions of the API.
know more about different data types and variables that are supported in Apex
How does it work?
As you can see, When a developer writes an apex code, Application Server compiles the code. Once the code is understandable by the apex interpreter then the code can be saved as metadata.
When end users trigger a request to perform some operation in apex, the application server retrieves the compiled apex code from metadata and sends them through runtime interpreter before returning the result.