SOLID Design Principles in Salesforce (Ep. 2) – The Single Responsibility Principle

SOLID Design Principles in Salesforce (Ep. 2) – The Single Responsibility Principle

In this second episode of the SOLID Design Principles Tutorial Series we go over what the Single Responsibility Principle is and how we can actually leverage it in both Apex and JavaScript. Click play! Do it bruh! Get Coding With The Force Merch!! We now have a redbubble store setup so you can buy cool…

SOLID Design Principles in Salesforce (Ep. 1) – What are the SOLID Design Principles?
|

SOLID Design Principles in Salesforce (Ep. 1) – What are the SOLID Design Principles?

If you’re here, you had better be ready to learn some of the most amazing concepts that the developers that came before you and I put together. The SOLID principles are some of the most important software design principles in existence, and if you want to produce some truly excellent and flexible code THIS IS…

Salesforce Development Tutorial (LWC): How to use Data Attributes to easily pass data from your component HTML template to your JavaScript Controller
|

Salesforce Development Tutorial (LWC): How to use Data Attributes to easily pass data from your component HTML template to your JavaScript Controller

What are Data Attributes and Why Should I Use Them? Data attributes are a truly magical thing that will, at some point, get you out of some prickly situations as a front end developer. They are essentially a way of storing data on an html element so that when a JS event gets fired your…

SoC and the Apex Common Library Tutorial Series Part 17: Implementing Unit Tests with the Apex Mocks Library
| |

SoC and the Apex Common Library Tutorial Series Part 17: Implementing Unit Tests with the Apex Mocks Library

What is Apex Mocks? Apex Mocks is unit test mocking framework for Apex that was inspired by the very popular Java Mockito framework. The Apex Mocks framework is also built using Salesforce’s Stub API which is a good thing, there are mocking frameworks in existence that do not leverage the Stub API… you shouldn’t use…

SoC and the Apex Common Library Tutorial Series Part 16: Unit Test Mocks with Separation of Concerns
| |

SoC and the Apex Common Library Tutorial Series Part 16: Unit Test Mocks with Separation of Concerns

How does Unit Testing fit into Separation of Concerns? The answer to this is simple, without Separation of Concerns, there is no unit testing, it just simply isn’t possible. To unit test you need to be able to create stub (mock) classes to send into your class you are testing via dependency injection (or through…

SoC and the Apex Common Library Tutorial Series Part 15: The Difference Between Unit Tests and Integration Tests
| |

SoC and the Apex Common Library Tutorial Series Part 15: The Difference Between Unit Tests and Integration Tests

What is Unit Testing? Unit Testing, is a way to test the logic in one class and ONLY one class at a time. Most classes in your system at some point do one of the following: 1) Call to another class to get some work done. 2) Query the database directly in the class. 3)…

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 11: Implementing The Domain Layer with the Apex Common Library
| |

SoC and the Apex Common Library Tutorial Series Part 11: Implementing The Domain Layer with the Apex Common Library

The template for every Domain Class you create Every Domain layer class you create for an object should at minimum have the following logic in it for it to work as expected. To understand why the Constructor inner class is necessary in these classes check out the triggerHandler method in the fflib_SObjectDomain class here: fflib_SObjectDomain…