Deciding Coding Standards and Guidelines

Hi,

I have taken a look at some PR and I noted that the style of coding differs in significant amounts depending on the user. This will make the code to harder understand especially for people who want just want to follow this project as a learning opportunity.

eg. some user declare all variables, props, methods in this order from the top of the script
other declare variables, methods, and props in no order, (variables in the middle of the script)

This is why, in my opinion, a Unity Person should take the initiative and create a document for coding standards and guidelines so all the coders follow it.

Also, do not overengineer stuff, if you make it very complex, usually it will become harder to understand, especially for people who want to learn from the project.

5 Likes

I would second this. Having a consistent requirement for where script level variables should be declared as well as a variable and function naming scheme will definitely help readability, which will become important when we’re submitting bug fixing pull requests and the like.

Personally I prefer the style where script variables are declared at the top in a block, with all functions after all variables are declared. I find having variables declared between functions can get messy when debugging.

2 Likes

See this thread for people voting on coding standards: Vote for coding standards

Don’t know if Unity’s going to step in. It’s just on variable naming conventions for now. We’ll need to look at figuring out other standards as well.