In this blog-post series, we will learn about apex programming. Apex is official programming language for Salesforce Developers. It is strongly typed object-oriented programming language. The syntax of apex is very similar to Java programming language and for that reason it is also called as sister language of Java.
Features of Apex:
- Apex is a strongly typed object oriented programming language.
- Apex is compiled, stored and it runs on Force.com platform.
- Apex provides built-in support for unit test and execution. In order to deploy any code to production,Salesforce requires 75% code coverage.
Whenever salesforce developers write and save code on the force.com platform, the apex code is compiled and it is stored in the form of metadata.
Capabilities of Apex:
- Apex provides built in support for the following:
- Apex provides support for DML Calls. DML stands for Data Manipulation language. You can insert, update and delete records in salesforce using DML statements.
- Apex provides support for SOQL and SOSL queries. These statements are used to retrieve data in Salesforce.
- Apex has support for record locking which prevents conflicts during record update.
- Salesforce has in-built support for email services which can be used to send and receive emails.
If you want to modify a field name or field type of a field which is being referenced by Apex, Salesforce will send you warnings and errors to prevent the field from getting modified.
When can we use Apex Programming?
- You should only use Apex, if a functionality cannot be achieved using out-of-the-box features of Salesforce. If something can be done using the point and click application development, you should not write apex code for those things.
- You can use apex to write complex business logic.
- You can use apex if you need to call out an external web-service and process the results.
- If you need to handle emails (incoming or outgoing emails) in way more complex manner than the declarative features, in that case you can use apex.