Object-oriented programming in Apex
Apex is a fully featured object-oriented programming language that enables developers to utilize features such as inheritance, polymorphism, abstraction, and encapsulation to develop applications in a way that is easy to manage, scale, and test. It is often the case that many developers are first introduced to Apex through a trigger, which, by nature, is a very linear structure to organize code. A trigger will run from the first line to the last in order and does not have any of the standard OOP capabilities; triggers cannot implement an interface or extend any classes. Although it is a best practice to extract the logic within a trigger to a set of classes and methods, as we saw in Chapter 3, Triggers and Managing Trigger Execution, it is not a requirement to do so, and many triggers are still written that do not follow this best practice.
Many developers do not start to work with the object-oriented capabilities of Apex until they deal with...