Search Unity

Deciding Coding Standards and Guidelines

Discussion in 'Open Projects' started by Atheros21, Sep 30, 2020.

  1. Atheros21

    Atheros21

    Joined:
    Dec 3, 2015
    Posts:
    2
    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.
     
  2. SideSwipe9th

    SideSwipe9th

    Joined:
    Jan 10, 2019
    Posts:
    46
    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.
     
    Atheros21 and Arnav_Sanghavi like this.
  3. PitaBreadGames

    PitaBreadGames

    Joined:
    Sep 15, 2017
    Posts:
    5