Skip to content
StackDecode
AdvancedLesson 37 of 37

Best practices and design patterns

A checklist for maintainable orgs.

  • Clicks before code: prefer Flow and standard features; use Apex when you need to.
  • Bulkify everything; no SOQL/DML in loops; handle 200 records.
  • One trigger per object; logic in handler and service classes (separation of concerns).
  • Configuration in Custom Metadata, endpoints in Named Credentials; no hard-coded Ids.
  • Least-privilege security: permission sets, sharing, with sharing, WITH USER_MODE.
  • Meaningful names and documentation; remove unused fields and automation.
  • Test thoroughly and deploy from source control through a pipeline.
  • Plan for limits and data volume from the start.