Difference between Standard Controller and Custom Controller?

Custom controller:-
  • Custom controller defines its own functionality.
  • Use HTTP callouts or web services.
  • Override existing functionality (change how default actions work, create new actions, and moreā€¦).
  • Custom Controllers are associated with Visualforce pages through the controller attribute.
  • Create custom behavior (properties or methods).
  • It is an Apex class that implements all of the logic for a page without leveraging a standard controller.
  • Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
  • You would use this when your page is not dealing with a main object(Account,Contact etc).
  • Only one Apex class is used.
Standard Controller:-
  • It contain the same functionality and logic that are used for standard Salesforce pages.
  • It Can be used with standard objects and custom objects.
  • It can be extended to implement custom functionality using extensions* keyword.
  • You would use this when you have a single object to manipulate.
  • Standard controller in apex, inherits all the standard object properties and standard button functionality directly.
*Extensions:- Multiple Apex classes separated by comma are used. extends the functionality of a standard or custom controller.

Leave a Reply