Separation of concerns
As you can see, there are a number of places Apex code is invoked by various platform features. Such places represent areas for valuable code to potentially hide. It is hidden because it is typically not easy or appropriate to reuse such logic as each of the areas mentioned in the previous table has its own subtle concerns with respect to security, state management, transactions, and other aspects such as error handling (for example, catching and communicating errors) as well as varying needs for bulkification.
Throughout the rest of this chapter, we will review these requirements and distill them into Separation of Concerns (SOC), which allows the demarcation of responsibilities between the Apex code used to integrate with these platform features versus the code implementing your application business logic, such that the code can be shared between platform features more readily today and in the future. Speaking more generally, SOC, regardless of the platform...