Overview of Apex Programming and its environment

Last updated on Nov 24 2021
Abha Kulkarni

Table of Contents

Overview of Apex Programming and its environment

What is Apex?

Apex may be a proprietary language developed by the Salesforce.com. As per the official definition, Apex may be a strongly typed, object-oriented programing language that permits developers to execute the flow and transaction control statements on the Force.com platform server in conjunction with calls to the Force.com API.
It has a Java-like syntax and acts like database stored procedures. It enables the developers to feature business logic to most system events, including button clicks, related record updates, and Visualforce pages. Apex code are often initiated by Web service requests and from triggers on objects. Apex is included in Performance Edition, Unlimited Edition, Enterprise Edition, and Developer Edition.

salesforce 63
salesforce

Features of Apex as a Language

Let us now discuss the features of Apex as a Language −
Integrated
Apex has inbuilt support for DML operations like INSERT, UPDATE, DELETE and also DML Exception handling. it’s support for inline SOQL and SOSL query handling which returns the set of sObject records. we’ll study the sObject, SOQL, SOSL intimately in future chapters.
Java like syntax and straightforward to use
Apex is straightforward to use because it uses the syntax like Java. for instance , variable declaration, loop syntax and conditional statements.
Strongly Integrated with Data
Apex is data focused and designed to execute multiple queries and DML statements together. It issues multiple transaction statements on Database.
Strongly Typed
Apex may be a strongly typed language. It uses direct regard to schema objects like sObject and any invalid reference quickly fails if it’s deleted or if is of wrong data type.
Multitenant Environment
Apex runs during a multitenant environment. Consequently, the Apex runtime engine is meant to protect closely against runaway code, preventing it from monopolizing shared resources. Any code that violates limits fails with easy-to-understand error messages.
Upgrades Automatically
Apex is upgraded as a part of Salesforce releases. we do not need to upgrade it manually.
Easy Testing
Apex provides built-in support for unit test creation and execution, including test results that indicate what proportion code is roofed , and which parts of your code are often more efficient.
When Should Developer Choose Apex?
Apex should be used once we aren’t ready to implement the complex business functionality using the pre-built and existing out of the box functionalities. Below are the cases where we’d like to use apex over Salesforce configuration.
Apex Applications
We can use Apex once we want to −
• Create Web services with integrating other systems.
• Create email services for email blast or email setup.
• Perform complex validation over multiple objects at an equivalent time and also custom validation implementation.
• Create complex business processes that aren’t supported by existing workflow functionality or flows.
• Create custom transactional logic (logic that happens over the whole transaction, not just with one record or object) like using the Database methods for updating the records.
• Perform some logic when a record is modified or modify the related object’s record when there’s some event which has caused the trigger to fireside .
Working Structure of Apex
As shown within the diagram below (Reference: Salesforce Developer Documentation), Apex runs entirely on demand Force.com Platform

salesforce 64
salesforce

Flow of Actions

There are two sequence of actions when the developer saves the code and when an user performs some action which invokes the Apex code as shown below −

Developer Action
When a developer writes and saves Apex code to the platform, the platform application server first compiles the code into a group of instructions which will be understood by the Apex runtime interpreter, then saves those instructions as metadata.
End User Action
When an end-user triggers the execution of Apex, by clicking a button or accessing a Visualforce page, the platform application server retrieves the compiled instructions from the metadata and sends them through the runtime interpreter before returning the result. The end-user observes no differences in execution time as compared to the quality application platform request.
Since Apex is that the proprietary language of Salesforce.com, it doesn’t support some features which a general programing language does. Following are a couple of features which Apex doesn’t support −
• It cannot show the weather in interface .
• You cannot change the quality SFDC provided functionality and also it’s impossible to stop the quality functionality execution.
• Creating multiple threads is additionally impossible as we will roll in the hay in other languages.

Understanding the Apex Syntax

Apex code typically contains many things that we’d be conversant in from other programming languages.
Variable Declaration
As strongly typed language, you want to declare every variable with data type in Apex. As seen within the code below (screenshot below), lstAcc is said with data type as List of Accounts.
SOQL Query
This will be wont to fetch the info from Salesforce database. The query shown in screenshot below is fetching data from Account object.
Loop Statement
This loop statement is employed for iterating over an inventory or iterating over a bit of code for a specified number of times. within the code shown within the screenshot below, iteration are going to be same because the number of records we’ve .
Flow Control Statement
The If statement is employed for flow control during this code. supported certain condition, it’s decided whether to travel for execution or to prevent the execution of the actual piece of code. for instance , within the code shown below, it’s checking whether the list is empty or it contains records.
DML Statement
Performs the records insert, update, upsert, delete operation on the records in database. for instance , the code given below helps in updating Accounts with new field value.
Following is an example of how an Apex code snippet will appear as if . We are getting to study of these Apex programming concepts further during this tutorial.

salesforce 65
salesforce

So, this brings us to the end of blog. This Tecklearn ‘Overview of Apex Programming and its environment’ blog helps you with commonly asked questions if you are looking out for a job in Salesforce. If you wish to learn Salesforce and build a career in Salesforce domain, then check out our interactive, Salesforce Certification Training: Admin 201 and App Builder, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Salesforce Certification Training: Admin 201 and App Builder

Salesforce Certification Training: Admin 201 and App Builder

About the Course

Salesforce Certification Training course will help you pass the Salesforce Administrator Exam (Admin 201) and the Salesforce App Builder (Dev 401) Exam. Concepts on Force.com Platform, AppExchange, SFDC Security Model, Service Cloud, Sales Cloud, Lightning App Builder, Salesforce Reports & Dashboard can be mastered in this Salesforce Training course. You can also configure the platform, manage users, find better ways to use the platform’s features, build applications with Salesforce Lightning, and more. Further, in this Salesforce certification training course, you will master App builder, Apex, Visualforce, etc.

Why Should you take Salesforce Admin 201 and App Builder Training?

• As per Indeed.com data, 200% global jump in Salesforce jobs since Jan 2016. Salesforce Certified Administrators earn an annual average salary of $87,000 but can go as high as $160,000 depending on their knowledge, skills, and experience.
• More than 200,000 companies worldwide use Salesforce platform. Salesforce leads the CRM market with 19.5 percent of market share – Forbes.
• The global CRM software market will reach US$40.26 billion in 2023, up from US$36.9 billion (2020) – Statista.

What you will Learn in this Course?

Salesforce Fundamentals
• Introduction to CRM concepts and Cloud computing
• Salesforce.com Overview and Fundamentals
• Understanding Salesforce Platform
Understanding Salesforce Platform
• Understanding Salesforce Terminologies and Introducing the force.com platform
• Understanding Salesforce Metadata and API
• Describe the capabilities of the core CRM objects in the Salesforce schema
• Identify common scenarios for extending an org using the AppExchange
• About Salesforce Certification
Introduction to Sales Cloud
• Sales Cloud
• Sales Process
• Sales Productivity Features
• Lead Management
• Lead auto response
• Lead assignment
• Web to lead
• Accounts and Contacts Management
• Opportunities
• Campaign Management
Security Model, User Management and Its Features
• Security Model Mind Map
• System Level or Org Level Security
• User Administration and Troubleshooting
• Permission Sets
• Profile Management
• User Actions
• Assigning Permission
• Session settings
• Activations
• Page layout assignment
• Tab setting
• Field level security
Object, Record and Field Level Features
• Custom Object
• Custom Field
• Data Types
• Relationship among Objects
• Working with App and Tabs
Data Handling and Processing
• Data Import and Export with Salesforce
• Insert, Update and Delete Data with Salesforce
• Export Data with UI
• Export Data using Data Loader Tool
Deployment
• SandBox
• Moving Data from SB to Production – Deployment
• Types of SandBox
• Change Sets
• Types of Change Sets
Application Cycle
• Milestones
• Sandboxes
• Change Sets
• Packages
Reports and Dashboards
Declarative Implementation in Salesforce
Salesforce Development and Apex Programming
• Apex Programming
• Apex Classes
• Apex Settings
• SOQL – Salesforce Object Query Language
• DML Commands
• Apex Class in Detail
• Apex Triggers
• Apex Testing
• Access Specifier in Salesforce
• Testing
Lightning in Salesforce
• Lightning Components
• Lightning Component Capabilities
• Lightning Components vs. Visualforce
Visual Force in Salesforce
• Standard Visualforce controller and controller extensions,
• Visualforce Page
• Understanding the MVC Pattern
• Tools for Visualforce Development
• Visual Force Components
WorkFlows in Salesforce
• Work Flows in Salesforce
• Types of Work Flows
• Work Flows Rules
About Preparation of Salesforce 201 and App Builder Certification exams

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Overview of Apex Programming and its environment"

Leave a Message

Your email address will not be published. Required fields are marked *