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
AbAb 

best pactises to name the fields

Hello,

Are there any salesforce tools to manage the names of the resources or any general rules o follow to name the classes, VF, Lightning components, laysouts, etc

thank you for any inputs
Best Answer chosen by Ab
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sandrine,

Greetings to you!

You can use the naming convention for your Apex Classes, Triggers, VF Pages, Components, etc i.e.; use some specific keyword when creating classes, pages, etc:
  • Prefixing class names: 
           {prefix}_classname.cls

           eg.: Page_AccountTable
                  Trgr_AccountDuplicate
 
  • Suffixing class names: 
           classname_{suffix}.cls

           eg.: AccountTable_page
                  AccountDuplicate_trgr

Apex classes are stored in the classes folder in the corresponding package directory. You cannot create a package in Salesforce to put your class. Salesforce put all the classes in a default folder. Apex classes doesn’t support nested namespaces or packages like Java to organize code in a clean way.

Please refer to below links for more information on naming convention in Salesforce.

https://github.com/cfpb/salesforce-docs/blob/master/_pages/Salesforce-Naming-Conventions.md

https://focusonforce.com/configuration/salesforce-naming-conventions-are-not-just-for-devs/

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_naming_conventions.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Sandrine,

Greetings to you!

You can use the naming convention for your Apex Classes, Triggers, VF Pages, Components, etc i.e.; use some specific keyword when creating classes, pages, etc:
  • Prefixing class names: 
           {prefix}_classname.cls

           eg.: Page_AccountTable
                  Trgr_AccountDuplicate
 
  • Suffixing class names: 
           classname_{suffix}.cls

           eg.: AccountTable_page
                  AccountDuplicate_trgr

Apex classes are stored in the classes folder in the corresponding package directory. You cannot create a package in Salesforce to put your class. Salesforce put all the classes in a default folder. Apex classes doesn’t support nested namespaces or packages like Java to organize code in a clean way.

Please refer to below links for more information on naming convention in Salesforce.

https://github.com/cfpb/salesforce-docs/blob/master/_pages/Salesforce-Naming-Conventions.md

https://focusonforce.com/configuration/salesforce-naming-conventions-are-not-just-for-devs/

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_naming_conventions.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
AbAb
Hi,

Thank you for reply. Are there any tools that can be used for naming conventions ?
Raj VakatiRaj Vakati
Its dependenet on the lot of factots like applications and company standards ext .. but 

Ideally

Triggers:
  • <ObjectName>Trigger - The trigger itself. One per object.
  • <ObjectName>TriggerHandler - Class that handles all functionality of the trigger
  • <ObjectName>TriggerTest
Controllers:
  • <ClassName>Controller
  • <ClassName>ControllerExt
  • <ClassName>ControllerTest
  • <ClassName>ControllerExtTest
Classes:
  • <ClassName>
  • <ClassName>Test (These might be Util classes or Service classes or something else).
Visualforce pages and components:
<ControllerClassName>[optionalDescription] (without the suffix Controller). There might be multiple views so could also have an extra description suffix.
Object Names and custom Fields
Upper_Case_With_Underscores
Variables/properties/methods in Apex
camelCaseLikeJava - more easily differentiated from fields
Test methods in test classes
test<methodOrFunctionalityUnderTest><ShortTestCaseDesc> - For example, testSaveOpportunityRequiredFieldsMissing, testSaveOpportunityRequiredFieldsPresent, etc.
 



Refer this link 

https://javarevisited.blogspot.com/2014/10/10-java-best-practices-to-name-variables-methods-classes-packages.html
https://howtodoinjava.com/java/basics/java-naming-conventions/
https://www.geeksforgeeks.org/java-naming-conventions/
http://codebuild.blogspot.com/2012/02/15-best-practices-of-variable-method.html
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

As of now, there are no tools for the naming convention in Salesforce.

Regards,
Khan Anas