-
Notifications
You must be signed in to change notification settings - Fork 0
2 Dodumentation And Commit Structure
The code should be idented, modular and easy to read.
Imports should be located on the head of the file, followed by the declaration of global variables.
If possible, the body of the file should have all the implemented methods/functions and (if appropriatte) the "main" function in the end of the file.
All functions must have an understandable name in a way that its functionality can be understood.
Avoid the use of atomic variables like, A , z, K, etc...
GOALS:
- Well formated code - spaced and pleasent to the eye
- Modular - avoid code repetition
- Easy to read - self explanatory variable and function names
Before the implementation of each function there must be a comment block following the structure bellow:
-
Function description
-
@var1 - description of the variable var1
-
@var2- description of the variable var2
-
Return: - Description of what the function returns (when applicable)
//Example of a function to compare two dates in C
/**
*
* Compares if date1 is after date2
*
* @date1- date object
* @date2- date object
*
* Return:
* 0 - date1 is not after date2
* 1 - date1 is after date2
*/
int compareDate(Date *date1, Date *date2){
if (date1->year > date2->year){
return 1;
}
else if (date1->year == date2->year && date1->month > date2->month){
return 1;
}
else if (date1->year == date2->year && date1->month == date2->month && date1->day > date2->day){
return 1;
}
else{
return 0;
}
}New implemented functions preceded by the +function name and a brief text with the description of the function.
Example:
+compareDate - function that compares two dates and outputs 1 if the first argument date is after the seconde argument date
+changeDateDay - function that changes the date of a given date object
Function hotfixes should also be preceded by +function name, description of the problem solved and solution
Example:
+changeDateDay - Function was changing the year instead of the day, switched code back to changing day
Function deletion should be preceded by -function name and description if needed
Example:
-changeDateDay - Function was changing the year instead of the day, switched code back to changing day