Apex code best practices

Best practices for efficient and scalable apex code

1.Bulkify your code --> use trigger.new
2.Avoid SOQL quires inside the for loop
3.Avoid DML operation inside the for loop
4.Use combination of collections and streamlining SOQL quires.
5.Avoid Multiple triggers on the same object.
6.Wrtite Test Methods to verify large datasets.
7.Avoid Hardcoding Ids
8.Use Batch apex class to avoid Governer limits.

Source: developerforce
Link:- http://wiki.developerforce.com/page/Apex_Code_Best_Practices


Popular Posts