Skip to content
Coding With The Force edited this page Oct 6, 2022 · 42 revisions

What Is This Wiki?

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.

If you enjoy this wiki and would like to say thank you, feel free to send a donation here! But no pressure, I really just do this for fun!


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 Testing and Separation of Concerns
  17. Implementing Unit Testing with Apex Mocks

Submitting Wiki Feedback

If you believe there is any information missing from this guide or that it needs more info in certain places, please submit an issue on this repo here and I'll add it ASAP!