Skip to content
Jonathan Rufino edited this page Sep 11, 2015 · 5 revisions

Histórico de Atualização

Data Versão Descrição Responsável
09/09/2015 1.0 Criação do Documento Jonathan Rufino
09/09/2015 1.1 Definição dos Estilos Tiago
10/09/2015 1.2 Revisão Tiago
10/09/2015 1.3 Revisão Jonathan Rufino

1. Names

  • Every variable must have their names in english;

  • Every branch, commit and issue must be written in english;

  • The variable names must be written on “mixedCase” rule, with significant names:

float thisIsAVariable;
  • The function names must be written on “mixedCase” rule, with significant names:
void methodOne;
  • The class names must follow the CamelCase rule:
class MyClass;
  • The constant names must be written with capital letters, separating the words with ‘_’:
const int NUMBER_PEOPLE;

2. Strings

  • It must be used double quotation mark ("") instead of single quotation mark ('') in all possible cases:
askClientName = "Escreva o nome do cliente: ";

3. Parenthesis

  • It must be used on the following cases:

3.1. Conditionals:

if(valueTotal == valueMonth && valueMonth == valueDay)

3.2. Functions:

void rankingEnade(int value)

4. Braces

  • It must open the keys on the below line:

4.1. Conditionals:

if(valueTotal == valueMonth && valueMonth == valueDay) {   
    // Do Something   
}

4.2. In Functions:

float calculatesProfit(int days) {   
    // Do Something Else   
}

4.3. In Classes:

class SchoolEnade {   
    // To Do   
}   

5. Spacing:

  • It must be put a blank (' ') on the following cases:

5.1. Conditionals (after if and between the variables):

if(schoolBase > schoolCompare)

5.2. Functions (between the parameters):

cleanFields(allFields, personEnterprise)

5.3. When you use the character ‘&’ to indicate parameter passing by reference, it must be put ‘&’ along with the variable name:

void schoolDepartmentRanking(int &referenceVariable)

6. Comment

6.1. One line comment:

// This method is responsible to calculate ENADE's grades   

6.2. More than one line comment:

/* This method is responsible to show ENADE's grades   
* with University's Name, University's City and    
* University's State */

7. Math Operations

(valueMonth * amountMonth) / (quantityEmployees)
(“The month value is” + valueMonth);
  • It must not exist a blank character after parenthesis or double quotation mark:
strWarning = (“Type Again:”);

8. Line break

  • There should not be an extra line break between a function declaration and the begining of the code:
if(quantityProduct == quantityStorage) {
    // ToDo
}
  • There should be an extra line break between programming blocks:
for(estado = 0; estado < numeroEstadosPais; estado = estado + 1) {   
    // ToDo   
}    

for(escola = 0; escola < numeroEscolaEstado; escola = escola + 1) {   
    // ToDo   
}
  • There should be a line break between the parameters of the builders:
public Client(String name,   
    String cpf,
    String telephone,    
    String age,     
    Address address) { 
    // Constructor
}
  • There should be a line break after the header of a class
/**********************************************************     
* File: GestaoEmpresa.java   
* Purpose: Main menu of the program.    
**********************************************************/      
           
public class GestaoEmpresa {
    // Class declaration
}

9. Documentation

  • Every function must have an explanatory comment block in english starting with ‘/’ and ending with ‘/’:
/* This function calculates the profit
* of the month in the sales department */
  • Every block has an explanatory comment
// This sum calculates the amount of money spent on a given time period

10. Header

  • Every file must have a header containing one line with the name of the file and another with the purpose of the file:
/************************************************
* File: JuridicalClient.java    
* Purpose: JuridicalClient class implementation.   
*************************************************/

Clone this wiki locally