Development Best Practices
  • Home
  • Clean Code
  • Apex
    • Naming Conventions
    • Triggers
    • Unit Testing
    • Principles
      • KISS
      • DRY
      • Single Responsibility
      • Open/Closed
      • YAGNI
    • Patterns
    • SOQL
    • Exception Handling
    • Magic Strings
  • Lightning Components
    • Aura
    • LWC
  • Automation
    • Process Builder
  • Salesforce DX and VSCode
  • Git Source Control
    • Install Git
    • Using Git
    • Development Workflow
      • The Rules
    • Feature Branch Workflow
Powered by GitBook
On this page
  1. Apex

SOQL

When writing SOQL queries, it is a good idea to keep them readable.

Even though SOQL special words and function names are case insensitive, it is common practice to capitalise them to distinguish them from your table and column names.

// bad

list<account> accounts = [select id, name from account where createddate < today()];

// good

List<Account> Accounts = [SELECT Id, Name
                          FROM Account
                          WHERE CreatedDate < TODAY()]
PreviousPatternsNextException Handling

Last updated 5 years ago