I recently revised the original Factory pattern article, and wanted to write a follow-up after a few years' spent reflecting on its usage within Apex. In particular, I'd like to talk a little bit about the Singleton pattern, and how with a small amount of work we can enhance the existing Factory class in order to gracefully create cached instances of classes where a large amount of work goes into constructing them.| www.jamessimone.net
We owe our ability to understand abstractions in programming to philosophy; much as we owe a debt to mathematics for putting the theorems responsible for our code -- and computers -- to work into words. Consider the immortal words present in the Tao: A well-shut door will stay closed without a latch. Skillful fastening will stay tied without knots. One does not simply (walk into Mordor) build a door that works well. A factory for doors cannot provide you with the quality of worksmanship and p...| www.jamessimone.net
Expressing intent through naming is a challenge, but well-named methods can help to expose even the most complicated of programming mechanisms. In programming, as in life, context is key - let's explore how naming can elevate the intent and rationale behind code! Whether you're just beginning your programming journey or you're a veteran programmer of many years, it's my hope that there's something in this post for everybody.| www.jamessimone.net
A few months ago I was tasked with replacing Declarative Lookup Rollup Summaries (DLRS) in an org suffering from frequent deadlocks. Rollup summary fields in Salesforce are plagued by severe limitations -- only being available on master-detail relationships being just the start of the list. Read on to learn about how I built Rollup to assist in orgs looking for DLRS-like flexibility with a much smaller performance overhead, complete with elastic scaling (go fast when you need to, slow when th...| www.jamessimone.net
Setting delays programmatically within Apex represents a unique challenge. We don't have access to the current thread instructions that are being carried out, nor do we have any kind of higher-level `delay` function. While this is frequently fine for internal usage, where the last thing you would want is for your compiled code to be slow, that's not always the case when interacting with external APIs. It's common for APIs to be 'rate-limited' - go over the number of requests you're supposed t...| www.jamessimone.net
Synchronous apex methods typically use asynchronous future methods to perform API calls, or callouts in Apex. This article covers the best way to execute performant HTTP-related code, while allowing for further processing to be done. It makes use of the Queueable interface in Apex, and shows how to implement the Queueable interface with the least amount of boilerplate.| www.jamessimone.net
Surfacing Apex exceptions through a dedicated logging platform so that exceptions in your Salesforce code can be easily monitored.| www.jamessimone.net