Why conventions?
ll structure, assets, and code in any project should look like a single person created it, no matter how many people contributed
Moving from one project to another should not cause a re-learning of style and structure. Conforming to a style guide removes unneeded guesswork and ambiguities.
It also allows for more productive creation and maintenance as one does not need to think about style. Simply follow the instructions. This style guide is written with best practices in mind, meaning that by following this style guide you will also minimise hard to track issues.
Friends do not let friends have bad style
If you see someone working either against a style guide or no style guide, try to correct them.
Code
We used the .NET standards as a starting base, and the following are our own changes.
Wording
- Use descriptive and accurate names, even if it makes them longer. Favor readability over brevity.
- Do not use abbreviations.
- Use acronyms when they are an accepted standard. Ex: UI, IO
- Method names should be verbs or verb phrases.
- Property names should be nouns, noun phrases or adjectives.
- Boolean properties should be affirmative phrases. You can prefix a Boolean property with “Is”, “Has”, “Can”. Ex: IsActive, CanJump.
- If multiple properties relate to the same item, use the item name as a prefix and add the property type, or role. Ex:
Color _gameTitleColor;
TextMeshProUGUI _gameTitleText;