Force.com Best Practices - APEX
Force.com
Best Practices:
Apex
·
Since Apex is case insensitive you can write it however you'd
like. However, to increase readability, follow Java capitalization standards
and use two spaces instead of tabs for indentation.
·
Use Asynchronous Apex (@future annotation) for logic that does
not need to be executed synchronous.
· Asynchronous Apex should be "bulkified".
·
Apex code must provide proper exception handling.
·
Prevent SOQL and SOSL injection attacks by using static queries,
binding variables or the escapeSingleQuotes method.
·
When querying large data sets, use a SOQL
"for" loop
·
Use SOSL over SOQL where possible - it's much faster.
·
Use Apex Limits Methods to avoid hitting governor exceptions.
·
No SOQL or SOSL queries inside loops
·
No DML statements inside loops
·
No Async (@future) methods inside loops
·
Do not use hardcoded IDs
Force.com Best Practices - APEX
Reviewed by dasfrogpractice
on
06:06
Rating:
No comments: