Skip to main content

Coding Convention

Here you will find all the basic resources to start a project, let us know if you have any doubt!. As a general rule, always use english for all the code-related stuff.

Variables

  • Use camelCase for all variables.
  • Declare the variable type unless is a for loop (dont use var).
  • The variable name should explain what data is storing.
int remainingTime = 5;
  • Use var declaration inside the foor loops.
for (var i = 0; i < 100; i++)
{
    //code
}

Constants

Use SNAKE_CASE for all constants.

public const int MAXIMUM_ROUNDS = 5;

Properties, methods and classes

  • Use PascalCase for all fields.
  • Start the formatting with no more than one than one new line
  • Delcare if its public or private

Good practice example:

public class GameController () 
{
    private void RestartGame () 
    {
        //code to restart the game
    }

    private void VictoryScreen ()
    {
        //code to show the victory screen
    }
}

Bad practice example:

public class GameController (){

    private void restartGame () 
    {
        //code to restart the game
    }


    void VictoryScreen () {
        //code to show the victory screen
    }
}

Commenting

  • Only use comments when neccesary (Like when a method name is not clear enough)
  • Place the comment on a separate line, not at the end of a line of code.
  • Begin comment text with an uppercase letter.
  • Insert one space between the comment delimiter (//) and the comment text, as shown in the following example.
// The following declaration creates a query. It does not run
// the query.
  • Don't create formatted blocks of asterisks around comments as shown below
/***************************
 * Fancy important comment *
 ***************************/

LeanTween

For general tweening or UI animations, we use LeanTween you can check their documentation here.