Skip to content
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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mdebarros
Copy link
Member

@mdebarros mdebarros commented Dec 8, 2020

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.

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.
elnyry-sam-k
elnyry-sam-k previously approved these changes Dec 8, 2020
- 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`.
Copy link
Contributor

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....

Copy link
Member Author

@mdebarros mdebarros Dec 9, 2020

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

@mdebarros mdebarros marked this pull request as draft December 9, 2020 09:45
@mdebarros mdebarros changed the title Proposing Naming Convention standards Documenting Naming Convention standards Dec 16, 2020
@mdebarros mdebarros changed the title Documenting Naming Convention standards Document Naming Convention standards Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants