Book Image

Mastering Apex Programming

By : Paul Battisson
5 (1)
Book Image

Mastering Apex Programming

5 (1)
By: Paul Battisson

Overview of this book

As applications built on the Salesforce platform are now a key part of many organizations, developers are shifting focus to Apex, Salesforce’s proprietary programming language. As a Salesforce developer, it is important to understand the range of tools at your disposal, how and when to use them, and best practices for working with Apex. Mastering Apex Programming will help you explore the advanced features of Apex programming and guide you in delivering robust solutions that scale. This book starts by taking you through common Apex mistakes, debugging, exception handling, and testing. You'll then discover different asynchronous Apex programming options and develop custom Apex REST web services. The book shows you how to define and utilize Batch Apex, Queueable Apex, and Scheduled Apex using common scenarios before teaching you how to define, publish, and consume platform events and RESTful endpoints with Apex. Finally, you'll learn how to profile and improve the performance of your Apex application, including architecture trade-offs. With code examples used to facilitate discussion throughout, by the end of the book, you'll have developed the skills needed to build robust and scalable applications in Apex.
Table of Contents (21 chapters)
1
Section 1 – Triggers, Testing, and Security
8
Section 2 – Asynchronous Apex and Apex REST
15
Section 3 – Apex Performance

Loading test data using Test.loadData

Depending on the type of work you are doing as a developer, your testing practices may vary greatly. For those who work on consultative projects, defining test data in the way we have just described will enable you to have a simple-to-use framework for adding new data as you work with a client and is a simple way for any other developer who works with that client to maintain the data. For independent software vendor (ISV) organizations and those who are part of a team working on a defined internal environment, a greater level of quality assurance may occur with dedicated testing teams, to validate the solution through the UI. This is not to say that this does not happen on consultative projects, but typically only organizations with an internal team dedicated to the solution will have the resources to perform such testing and management.

Using our test data factory structure from the preceding section presents us with a couple of potential...