Following the camelCase method where abbreviations are involved

Should it be: manageUi or manageUI ?

Should it be: coverUiPlayerFacade or coverUIPlayerFacade ?

That is a matter of personal preference. I’ve seen it both ways.

For me, if it is an acronym (pronounced like a word, like NATO or SCUBA or DOM) then I treat it like a normal word. If it is an initialism (pronounced as letters, like ACLU or URL) then I keep the casing the same in the word. In other words, if the initialism is at the start of the the camelCase word, then I have it all lowercase, and if it is not, then it is all uppercase.

// acronyms
let isPulledFromDom;
let domReader;

// initialisms
let isValidURL;
let urlFormatter;

But again, it is a matter of taste. There is no hard and fast rule. You figure out what works best for you and consistency and clarity are the most important thing.

For me, the second one makes the most sense since it is an initialism. But again, there will be people that disagree and there is no hard rule, to the best of my knowledge.

1 Like

Thank you for explaining that to me, I understand it better now.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.