Following the camelCase method

Should it be: manageUi or manageUI ?

Should it be: coverUiPlayerFacade or coverUIPlayerFacade ?

These are where abbreviations are involved.

Sorry but UI is not an abbreviation. It is an initialism instead.

Abbreviation, acronym, and initialism are three similar but very different things.

  • Abbreviations are a shortened form or a word or phrase. You won’t find UI in this large and comprehensive list of abbreviations. For example: N.Y., Mr. for Mister, lb for pound, PC for personal computer

  • When it is the start of each word and they are pronounced like a word, those are acronyms. For example, NASA (na-suh), ASAP (ay-sap), radar (ray-dar)

  • When it is the start of each word and they are separately pronounced individually, those are initialisms. For example, UI (you-eye), BMW (bee-em-double-you), IBM (eye-bee-em)

All of those are forms of abbreviations, but when something more appropriately fits in to a more specific category such as acronym or initialism, it’s helpful to refer to those instead.

Why that’s important in this case is that the camelCasing of initialisms differs from acronyms.

  • With BMW when that’s camelCased to getBmwData, that doesn’t work as well because the letters of BMW are pronounced separately. When using initialisms, keep them all the same case such as with getBMWData or bmwData instead.

  • Instead of manageUi use manageUI. Instead of coverUiPlayerFacade use coverUIPlayerFacade, or bring UI to the front so you can use it lowercase with uiCoverPlayerFacade instead.

  • With NASA for example, it’s okay for that to be camelCased as getNasaData because the Nasa is treated as being a word.

All of this is to say that with initialisms, either have them all uppercase or all lowercase to avoid those problems.

3 Likes

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

1 Like

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