mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Naming guidelines. (#690)
* Added variable naming guideline * Added link as per Paul's suggestion. * Made variable naming section cover naming in general.
This commit is contained in:
parent
f5d80175fe
commit
c32c8e8def
@ -114,8 +114,8 @@ Start reading our code and you'll get the hang of it. We optimize for readabilit
|
||||
Only do GC optimizations and caching in hot path. Avoid it everywhere else to keep the code simple.
|
||||
* **Curly Braces { }**
|
||||
Always use braces even for one line if's. Unity did this everywhere, and there is value in not accidentally missing a line in an if statement because there were no braces.
|
||||
* **Variable naming**
|
||||
\`NetworkIdentity identity\`, not \`NetworkIdentity uv\` or similar. If the variable needs a comment the name needs to be changed. For example, `msg = ... // the message` use `message = ...` without a comment instead
|
||||
* **Naming**
|
||||
Follow [C# standard naming conventions](https://github.com/ktaranov/naming-convention/blob/master/C%23%20Coding%20Standards%20and%20Naming%20Conventions.md). Also, be descriptive. \`NetworkIdentity identity\`, not \`NetworkIdentity uv\` or similar. If you need a comment to explain it, the name needs to be changed. For example, don't do `msg = ... // the message`, use `message = ...` without a comment instead. Avoid prefixes like `m_`, `s_`, or similar.
|
||||
* **private**
|
||||
Fields and methods in a class are private by default, no need to use the private keyword there.
|
||||
* This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.
|
||||
|
Loading…
Reference in New Issue
Block a user