-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Naming Convention standards #286
base: master
Are you sure you want to change the base?
Conversation
Its widely accepted that camel case is used as a standard naming convention through-out Mojaloop's code-base, but there are edge scenarios that require further clarification that this PR tries to address. Credit to @vijayg10 for the suggested convention.
- Do not use abbreviations or contractions as parts of identifier names. For example, use `SettlementWindow` instead of `SetWin`. | ||
- Do not use acronyms that are not generally accepted in the computing field. | ||
- Where appropriate, use well-known acronyms to replace lengthy phrase names. For example, use `UI` for `User Interface`. | ||
- Use Pascal case or camel case for names more than two characters long depending on context (e.g. class names vs variable names). For example, use `SettlementWindow` (Class) or `settlementWindow` (Variable). However, you should capitalize abbreviations that consist of only two characters, such as `ID` instead of `Id`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about preferring ID
over Id
, but maybe that's personal preference. We seem to favour Id
over ID
in our code
But then again, maybe that's because Id
is short for Identifier
and not IDentifier
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, perhaps I should expand that to include: "where abbreviations are isolated and not part of a composite name".
i.e. The following would be valid:
- /transfer/{{TransferId}
- /transfer/{{ID}}
Example of this --> https://github.com/mojaloop/central-services-shared/blob/master/src/enums/endpoints.js#L110 <-- although our Enums are not adhering to the above-suggested convention :D
Based on the above example, we may need to add an exception for ENUMs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, 100% agree. Thanks for clarifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lewisdaly please have a look at my updates.
Its widely accepted that camel case is used as a standard naming convention through-out Mojaloop's code-base, but there are edge scenarios that require further clarification that this PR tries to address.
This PR is to document the naming convention standards used within Mojaloop, and an attempt to also clarify most of the known edge scenarios.
Credit to @vijayg10 for the suggested convention.