Hi KULWANT, This is a limitation in the force.com stack that makes medium-large size projects painful, if not impractical. Using
managed packages in order to get a package prefix don't really solve any problems, so it's not really worth the trouble.
I usually try to organize a project into one flat level of namespaces. In lieu of actual namespaces, I'll give each
would-be-namespace a 3-5 character name, to be used as a prefix. Any class that belongs in the "namespace" gets prefixed.
E.g., if I need a payroll namespace, I'd use a PYRL prefix. A class called PaycheckCalculator becomes
PYRL_PaycheckCalculator.
The practical advantage of this type of convention is it helps prevent name clashes and classes are grouped by their
"namespace" when viewed in a sorted list, such as in an IDE, or Setup > Develop > Apex Classes
Unfortunately, several basic OO principles are still fundamentally broken. Probably the most important one is every class
forms an implicit dependency on every other class it has visibility to, which is all of them.
You can see all the details through this link as it may be helpful in solving your problem: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_set.htm https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_namespace_prefix.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
May I suggest you please refer to below link from the stack overflow community which might help you further with the above issue.
- https://stackoverflow.com/questions/8377510/organizing-apex-classes-under-namespace
Please let us know if this helps.Thanks,
Nagendra
This is a limitation in the force.com stack that makes medium-large size projects painful, if not impractical. Using
managed packages in order to get a package prefix don't really solve any problems, so it's not really worth the trouble.
I usually try to organize a project into one flat level of namespaces. In lieu of actual namespaces, I'll give each
would-be-namespace a 3-5 character name, to be used as a prefix. Any class that belongs in the "namespace" gets prefixed.
E.g., if I need a payroll namespace, I'd use a PYRL prefix. A class called PaycheckCalculator becomes
PYRL_PaycheckCalculator.
The practical advantage of this type of convention is it helps prevent name clashes and classes are grouped by their
"namespace" when viewed in a sorted list, such as in an IDE, or Setup > Develop > Apex Classes
Unfortunately, several basic OO principles are still fundamentally broken. Probably the most important one is every class
forms an implicit dependency on every other class it has visibility to, which is all of them.
You can see all the details through this link as it may be helpful in solving your problem:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_set.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_namespace_prefix.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha