7

What is best practice around naming lightning components bundles in an org? Concerned as it components are visible across applications which means naming conflicts can occur.

Considering prefixing each lightning component with the application prefix. i.e. if I was building an auditing app called InternalAudit.app then all my resources would be prefixed by InternalAudit_ InternalAudit_List.cmp, InternalAudit_ListController.js ...

Am I missing something here or should it be considered best practice to prefix any lightning component with the application parent?

Anyone have a better technique?

1 Answer 1

0

I prefer using a Application name as prefix and follow the component specification .Lets say my application name is "Chat" .Then i would name my components as below

"chatcmp.cmp"

"chatcontroller.js"

"chatHelper.js"

"chatevent.evt"

"chatSVG.SVG"

Naming convention should be based on component functionality to make it easier to locate the compponents .

4
  • Thanks @Monith Shrivastava you are confirming my original thought. What bothers me about this is the following "According to the docs: developer.salesforce.com/blogs/developer-relations/2015/05/… “The overriding principle behind a component-based architectural approach is to engineer an application from a collection of functional modules that can work together in a loosely coupled manner. - Nov 18, 2015 at 4:39
  • "- By communicating through a carefully designed public interface and an event messaging model, such components can provide great efficiencies in the rapid development of applications by allowing developers to hook together modular building blocks which can also be easily reused across applications. The component approach provides reuse benefits beyond a traditional object oriented inheritance paradigm by enabling a “plug and play” model. Once a component has been written and tested, it can be made available for use and reuse in any application requiring its functionality. -" Nov 18, 2015 at 4:40
  • This is particularly beneficial for enterprise application development, as IT teams can reuse components across multiple applications or even Salesforce orgs.” My concern with prefix the appName to the component is it tends to move away from true component based ideals to an app centric model. One would never want to use this application specific components as they are app specific. Sorry for multiple post but long response.. Nov 18, 2015 at 4:41
  • Glad I found this, got the same question: Not new to the world of Coding Rules and Naming Conventions myself but since the number of component parts (Parent - Child - Grandchild + events per component) will be immense after a while, I am looking for some kind of system that will work for 100s of components and several developers on those / admins using those. I have searched for similar Frameworks' Conventions - e.g. ReactJS, but those rely on folder structure, too. A level of abstraction we do not have for Lightning Components. Feb 4, 2016 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .