Apex – The (programming) language in the Salesforce universe
Salesforce’s programming language is called Apex and is hardly known outside the Salesforce universe. Especially for young developers who stumble across Salesforce as part of their career planning, the question often arises: What is Salesforce Apex?
To answer that, however, we need to start one point earlier. There are two types of programming languages: General-purpose languages and domain-specific languages. Comparing them directly is almost as useful as comparing watermelons & apples: as good as not. On the other hand, however, the question remains how to decide which one to devote one’s career to without comparing the languages.
So let’s dare to compare the path of a Salesforce developer with other existing technologies on the market. To do this, we’ll take a close look at one key skill: programming in different programming languages using the Apex reference language.
An overview of the development in Salesforce
It is easy to imagine that Salesforce Development consists only of the function of writing Apex code. However, that is not all. In addition to Apex, Salesforce has Visualforce, LWC, Aura, and SOQL/SOSL. Not to mention all the no-code tools that Salesforce provides.
When young developers come from other programming backgrounds, they already have an idea of all these technologies. Salesforce’s strategy was not to invent something completely new, but to take advantage of existing approaches to programming. Let’s start with the most used technology on the Salesforce platform – Apex.
Apex in Salesforce
Apex is a core Salesforce language. Officially, it is “a strongly typed, object-oriented, domain-specific back-end programming language.” For developers this makes sense, for beginners or non-developers it turns out to be more difficult. So let’s compare each aspect of Apex with the most popular programming languages on the market.
In the process, each customer in CRM can be viewed as an object. Basically, that’s what happens – every record in Salesforce is represented as an object instance in Apex.
Similarity with Java
Most users agree that the syntax of Apex is very simple compared to Java. This is indeed the case, however Apex represents a completely different programming language. The differentiation between them is comparable to that of C# to Kotlin Java. Both are similar, but still represent different languages.
The main difference is the simplicity of Apex. If there are 10 ways to achieve the same result in Java, there is often only one way to do it in Apex. Apex does not have streams, lambdas, and other advanced Java features. This does not mean that Apex is less powerful than Java. Not at all! The real power of Apex is how integrated it is with the Salesforce platform. Conversely, you could equally say that Apex is nothing without Salesforce. In fact, Apex cannot be run outside of Salesforce. This has some implications for how development is done with Apex, as it doesn’t run on local to your own computer, but instead must be sent to Salesforce’s server.
The special feature of Apex
So what is special about Apex? First and foremost, the speed with which it can develop a useful feature for businesses. When Apex is compared to other languages in this regard, Apex is a sure winner. The way Apex works is illustrated by a concrete example:
Let’s say that a brand wants to email a customer two days after they purchased your service. In Apex, the average implementation time for this use case is about 15 minutes. In Java, on the other hand, it would take much longer to achieve the same result. This is because in Apex all the data is already available. No database calls, no additional frameworks – just the focus on the actual business process to be programmed.
The speed of implementation depends on many factors, but in general the same business process can be implemented faster with Salesforce than on other platforms. This is, of course, a partly subjectively colored assessment. However, many users agree that learning Apex is simpler than learning Java because there is less syntax.
Either way, there are many topics unique to Salesforce and Apex, so there is a lot of input to learn. To understand Apex, it is an advantage to already know Salesforce. This means that in order to use Apex, you must first learn Salesforce.
Still, Apex is not the only thing to work with as a Salesforce developer! Let’s take a look at some other technologies.
When a company starts a business process, the process often begins in the minds of end users, who primarily think in terms of classic user interfaces. So, since Apex is a pure back-end language, a front-end language is equally needed for the whole casting: Visualforce is one of them.
If familiar with Java, Visualforce is basically comparable to JavaServer Faces (JSF). For those who don’t know it, it represents a combination of HTML, CSS, and a templating language. Visualforce is one of the oldest technologies on the Salesforce platform and is still in very limited use. However, it is still occasionally used to create good-looking PDF documents, for example.
Also, Visualforce can use Apex in the back-end to transfer the data to the front-end. A possible architecture would look like this:
One of the problems with front-end development is that it changes quickly. Over time, Salesforce has realized that the architectural approach they developed for Visualforce is not sustainable. Because of this, Salesforce has developed a new framework called Aura. It has a more modern architecture and allows you to develop more attractive applications than Visualforce.
Lightning Web Components (LWC)
Many years after the introduction of Aura, front-end development took another big leap: reactive development. As a result, Salesforce had to explore other technologies. That’s how Salesforce ended up with one of the most advanced frameworks to date: LWC (Lightning Web Components).
LWC is very similar to React and represents a fundamental change in front-end development experienced in the last 10 years. This framework can be used to create very flexible, modern-looking applications that are indistinguishable from other websites on the Internet. Unlike React, with LWC only Apex can be used as the back-end language.
SOQL & SOSL
Salesforce can be considered as a large database with many records. Even though Salesforce uses Apex as the backend, it needs SOQL to access data. SOQL (Salesforce Object Query Language) is like a simple version of the well-known SQL, but tailored for use in Salesforce.
The average day of a Salesforce developer looks something like this: a lot of back-end work, some front-end work, and a lot of business process work. This means that for successful first steps towards a career as a Salesforce Developer, a basic approach to Salesforce should have taken place, but above all, the programming languages and technologies used in the backend need to be mastered. And as with any good professional, additional skills round out the profile. Last but not least, a precise understanding of business models and the role profiles of end users is crucial to ensure a seamless good experience for the users in the company itself as well as for its customers.