SoC and the Apex Common Library Tutorial Series Part 14: Implementing the Selector Layer with the Apex Common Library
| |

SoC and the Apex Common Library Tutorial Series Part 14: Implementing the Selector Layer with the Apex Common Library

The Template for every Selector Class you create Every Selector layer class you create should at least implement the following methods for it to work as anticipated. The fflib_SObjectSelector Constructor Parameters and what each of them mean When you create a Selector class that extends the fflib_SObjectSelector class you have the option to send some…

SoC and the Apex Common Library Tutorial Series Part 13: The Selector Layer
| |

SoC and the Apex Common Library Tutorial Series Part 13: The Selector Layer

What is the Selector Layer The Selector Layer is Salesforce is based off Martin Fowler’s Data Mapper Layer concept. It’s, “a layer of Mappers that moves data between objects and a database while keeping them independent of each other and the Mapper itself”. In most tech stacks when you want to represent records in a…

SoC and the Apex Common Library Tutorial Series Part 12: The Builder Pattern
| |

SoC and the Apex Common Library Tutorial Series Part 12: The Builder Pattern

What is the Builder Pattern? The Builder Pattern is a Creational Design Pattern that allows you to construct a complex object one step at a time. Think about the construction of a car or your house or maybe something less complicated, like the construction of a desktop computer. When you’re creating a new desktop computer…

SoC and the Apex Common Library Tutorial Series Part 10: The Domain Layer
| |

SoC and the Apex Common Library Tutorial Series Part 10: The Domain Layer

What is the Domain Layer? The Domain Layer is, “An object model of the domain that incorporates both behavior and data”. – Martin Fowler In most coding languages you need to connect to the database, query for the data and then you create wrapper classes to represent each underlying table in your database(s) to allow…

SoC and the Apex Common Library Tutorial Series Part 9: The Template Method Pattern
| |

SoC and the Apex Common Library Tutorial Series Part 9: The Template Method Pattern

What is the Template Method Pattern? The Template Method Pattern is one of the more popular Behavioral Design Pattern. The Template Design Pattern basically is creating a genericized skeleton class that a sub class can extend and add functionality to. The genericized skeleton class has some core functionality pre-built, but expects you to fill out…

SoC and the Apex Common Library Tutorial Series Part 8: Implementing the Service Layer with the Apex Common Library
| |

SoC and the Apex Common Library Tutorial Series Part 8: Implementing the Service Layer with the Apex Common Library

Preparation for the rest of this article There is NO FRAMEWORK that can be made for service layer classes. This is a business logic layer and it will differ everywhere. No two businesses are identical. That being said, if you would like to leverage all of the other benefits of the Apex Common Library (primarily…

SoC and the Apex Common Library Tutorial Series Part 7: The Service Layer
| |

SoC and the Apex Common Library Tutorial Series Part 7: The Service Layer

What is the Service Layer? The Service Layer, “Defines an application’s boundaries with a layer of services that establishes a set of available operations and coordinates the application’s response in each operation”. – Martin Fowler This essentially just means that the service layer should house your business logic. It should be a centralized place that…

SoC and the Apex Common Library Tutorial Series Part 6: The fflib_SObjectUnitOfWork Class
| |

SoC and the Apex Common Library Tutorial Series Part 6: The fflib_SObjectUnitOfWork Class

What is the fflib_SObjectUnitOfWork class? It is a foundation built to allow you to leverage the unit of work design pattern from within Salesforce. Basically this class is designed to hold your database operations (insert, update, etc) in memory until you are ready to do all of your database transactions in one big transaction. It…

SoC and the Apex Common Library Tutorial Series Part 5: The Unit of Work Pattern
| |

SoC and the Apex Common Library Tutorial Series Part 5: The Unit of Work Pattern

What is the Unit of Work Pattern (UOW) A Unit of Work, “Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems”. The goal of the unit of work pattern is to simplify DML in your code and only commit changes to…

SoC and the Apex Common Library Tutorial Series Part 4: The fflib_Application Class
| |

SoC and the Apex Common Library Tutorial Series Part 4: The fflib_Application Class

What is the fflib_Application class? Quality question… I mean honestly wtf is this thing? Lol, sorry, let’s figure it out together. The fflib_Application class is around for two primary purposes. The first is to allow you an extremely abstract way of creating new instances of your unit of work, service layer, domain layer and selector…