function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eager-2-LearnEager-2-Learn 

Naming Convention Best Practices?

Hello,

 

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.

 

 

 

NaishadhNaishadh

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

 

 

Eager-2-LearnEager-2-Learn

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?

 

NaishadhNaishadh

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 :-)

 

Rohit.VermaRohit.Verma

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

 

Thanks,

 

Rohit.