Skip to content
Coding With The Force edited this page Apr 12, 2021 · 42 revisions

Wiki Explanation

This wiki hopes to simplify the concept of Separation of Concerns in Salesforce and leveraging the Apex Common Library to implement it. While this wiki hopes to make this easier, if you finish everything here and want even more information about this topic I would suggest reading Andy Fawcett's Salesforce Lightning Platform Enterprise Architecture Book. Specifically pages 159-268 for Separation of Concerns and how to use Apex Commons to implement it and pages 477-520 for information on Unit Testing and Apex Mocks. It's a lot harder to consume (in my opinion) than the wiki below, but it is loaded with valuable information. It's how I learned most of what I'm presenting to you in the repo.


Table of Contents:

  1. Introduction to the Separation of Concerns Design Principle
  2. Introduction to the Apex Common Library
  3. The Factory Pattern
  4. The fflib_Application Class
  5. The Unit of Work Pattern
  6. The fflib_SObjectUnitOfWork Class
  7. The Service Layer
  8. Implementing the Service Layer with the Apex Common Library
  9. The Template Method Pattern
  10. The Domain Layer
  11. Implementing the Domain Layer with the Apex Common Library
  12. The Builder Pattern
  13. The Selector Layer
  14. Implementing the Selector Layer with the Apex Common Library
  15. The Difference Between Unit Tests and Integration Tests
  16. Unit Test Mocks with Separation of Concerns
  17. Implementing Mock Unit Testing with Apex Mocks

Example Scenarios (Practice Time!)

  1. Example Apex Commons Scenario - Building an Abstract Case Management System
  2. Example Apex Mocks Scenario - Mocking the Abstract Case Management System