Apex Anti-Patterns Overview
Apex Anti-Patterns Overview
SOQL Queries Inside Loops
SOQL Queries Inside Loops
DML Operations Inside Loops
DML Operations Inside Loops
Not Bulkifying Triggers
Not Bulkifying Triggers
Hardcoding Record IDs
Hardcoding Record IDs
Not Using the Limits Class
Not Using the Limits Class
Not Using Try-Catch Blocks
Not Using Try-Catch Blocks
Using System.debug for Production Logging
Using System.debug for Production Logging
Not Using Test.startTest() and Test.stopTest()
Not Using Test.startTest() and Test.stopTest()
Not Using @TestVisible
Not Using @TestVisible
Not Using SObjectType for Field and Object Access
Not Using SObjectType for Field and Object Access
Not Using WITH SECURITY_ENFORCED
Not Using WITH SECURITY_ENFORCED
Not Using Proper Sharing Settings
Not Using Proper Sharing Settings
with sharing
, without sharing
, or inherited sharing
. The with sharing
keyword enforces record-level security, while without sharing
bypasses it. Use without sharing
only when absolutely necessary, and document why it’s needed.Not Using Proper Trigger Frameworks
Not Using Proper Trigger Frameworks
Not Using Proper Naming Conventions
Not Using Proper Naming Conventions
Not Using Asynchronous Apex When Appropriate
Not Using Asynchronous Apex When Appropriate