---
schema_version: "1"
id: f120b333cfebb0643d82accb142dea5a4772329e07aeb234a96f6f00d52946df
title: Custom Controllers and Controller Extensions
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/controller/pages-controller.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b32da75b7ff07a557ee5c3a6b6bff4c4849f40862c1d7322495c9e0279fd8d22
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Custom Controllers and Controller Extensions

Standard controllers can provide all the functionality you need for a Visualforce page because they include the same logic that is used for a standard page. For example, if you use the standard Accounts controller, clicking a **Save** button in a Visualforce page results in the same behavior as clicking **Save** on a standard Account edit page.

However, if you want to override existing functionality, customize the navigation through an application, use callouts or Web services, or if you need finer control for how information is accessed for your page, you can write a custom controller or a controller extension using Apex.

-   **[What are Custom Controllers and Controller Extensions?](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-def.md)**  

-   **[Build a Custom Controller](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-custom.md)**  


    A custom controller is an Apex class that uses the default, no-argument constructor for the outer, top-level class.

-   **[Building a Controller Extension](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-extension.md)**  

-   **[Building a Custom List Controller](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-custom-list-controller.md)**  

-   **[Controller Methods](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-methods.md)**  

-   **[Controller Class Security](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-security.md)**  

-   **[Working with Large Sets of Data](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-readonly-context.md)**  

-   **[Considerations for Creating Custom Controllers and Controller Extensions](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-considerations.md)**  


    Note the following considerations when creating controller extensions and custom controllers.

-   **[Order of Execution in a Visualforce Page](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-lifecycle.md)**  

-   **[Test a Custom Controller](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-error-handling.md)**  


    To ensure error-free code, create and execute Apex unit tests for every custom controller and controller extension that you write. Unit tests are class methods that verify whether a particular piece of code works properly. Unit test methods take no arguments, commit no data to the database, and are flagged with the `@isTest` annotation in the method definition.

-   **[Validation Rules and Custom Controllers](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-validation.md)**  


