This content is not currently supported on this browser.
+ Start a Discussion

Naming Convention Best Practices?



I noticed in SFDC documentation examples that the naming convention for BATCH, SCHEDULE, and TEST classes is to prefix those words to the the class (i.e.: Batch_MissingOpportunityPartnersCheck) but when you look at the SFDC Apex class page that puts the related class apart from one another in the list.


Being new to this environtment, I appended those words to name of the class (i.e.: MissingOpportunityPartnersCheck_Batch) this way I see the related classes together  when viewing.


How you others naming their classes, prefixing or appending?  In a real large environment what is working best for you?  I know I can do what I want but I wanted to follow the best practice.





Ideally, the patterns which you stick with are considered as best practices. But we follow following pattern


1. Class -

    a. Controller Class - <Objectname>Controller

    b. Utility Class - related with object - <ObjectName>Utilities

    c. Other - Proper name with first letter capital

2. Trigger

     a. <ObjectName>Trigger

3. Page

     a. If override button or link  - Override_<Object>_<new/edit>

     b. Other - Proper name with first letter capital




So to be clear...

You did not reference batch, test, or schedules but it looks like you are appending as to the name for controller, Utilities, etc.  Yes/No?



for batch - <ValidName>Batch

Test  method

Use seperate class with @isTest annotation. (This will help you write more lines of code. )

Class name : AllTestClass for Apex classes , AllTestVFClass - for VF Page and related classes

Scheduler - I haven't use it yet :-)



Can you please Guide me on the Naming Conventions of Unit Test Classes,In the format you have given bellow.