Considerations for creating custom controllers and controller extensions
When you are creating custom controllers and controller extensions, keep the following consideration in mind:
- The most important thing to keep in your mind is Apex governor limits.
- Apex classes can be run in the system mode and user mode by using
without sharing and
with sharing respectively. Sensitive data can be exposed without sharing controllers.
webservice methods must be defined as global. All other methods are public.
- Try to access the database in less time by using sets, maps, or lists. This will increase the efficiency of your code.
- Apex methods and variables are not instantiated in a guaranteed order.
- You cannot implement Data Manipulation Language (DML) in the constructor ...