Documentation of Standard Typing Rules
Scope Of Document
Scope of This Document
This document is a standard typing for code that applies only to markup/programming language training conducted by Mineversal. Precautions When engaging in development work in a different environment, it is necessary to comply with the coding standards determined for each site.
What Are Coding Conventions
A coding standard is a document that stipulates "rules for writing" when creating program code. By prescribing coding rules in advance, the aim is to make it easy for anyone to see (unification) and to eliminate potential defects (elimination of mistakes). In addition, even if you want to automatically process program code at once, such as a check tool or a conversion tool, you can expect the advantage that it is less likely to cause trouble if the program complies with coding standards.
Standard Typing Code
NUMBER OF CHARACTERS PER LINE
The maximum number of characters per line is 100 (double-width characters such as kanji are counted as two digits).
INDENTATION
Tabs are used for indentation, and the number of characters in the tabs is 4. Instead of tabs, no spaces shall be filled.
Note: "Notepad" is only for 8 characters, so it will not be 4 characters.
The description of blocks (units from { to }) is as shown in the following example, and the syntax is described after indentation.
Example:
1 | for ( i = 0; i < MSG_MAX; i++ ) |
Other example:
1 | if ( langId == LANG_EN ) |
In the case of nested states where blocks are created within blocks, further indent the area enclosed by { }.
1 | bool fs_tf_analizeFileUpCommand( char *cmd, int size ) |
Even if the block is a single statement and { } can be omitted, enclose it in { }.
1 | if( filePtr == null ) |
COMMENTS
In the code you create, be sure to write comments that do not rely on memory or knowledge, assuming that "others will see" or "maintain them yourself when you forget them in a few years." It is desirable that comments and internal design documents are linked. Even if an internal design document does not exist, try to write at a "text" level that is sufficient for internal design documents with only comments.
Comments in different programming languages vary quite a bit but are generally begin with / and end with /. Nesting is not allowed.
1 | playTime = 0; /* Initialize playing time */ |
To comment out an entire line, use #if0 ~ #endif. In this case, /* if 0 */ should be added as a comment to indicate what the #endif corresponds to. Also, insert a // at the beginning of the commented out line so that you can instantly recognize it as a comment just by looking at the line (when greping).
Note: There are some sites where inserting // is bad (a large number of // are hit in the process of searching for the division part and visually checking), so in that case, set it to @.
1 |
|
By the way, in C++, // can be used to comment out lines. It is not compatible with C and cannot be used in C.
1 | // Temporary < Random play mode is suspended> |
FORMULA
Expressions should be separated by spaces (spaces) for easy viewing. Follow the example and code with spaces.
1 | for( i = 0; i < MAX_LOOP_NUM; i++ ) |
HEADER RULES
Make sure after creating the files always insert comments as a header regarding the detailed description of the file at the top of the file, the format can be copied below:
Mark Up Languages (like HTML, MD, etc.):
1 | <!----------------------------------------------------------------------------------------------> |
Programming Languages:
C:
1 | /******************************************************************************/ |
Python:
1 | ##################################################################### |
Note: If there are more than one author, separate them with commas.
HISTORY RULES
If there are updated version in the code file you must add this note.
Markup Languages:
1 | <!-------------------------------------------------------------------------------------------------> |
Programming Languages:
C:
1 | /******************************************************************************/ |
Python
1 | ##################################################################### |
PACKAGES & LIBRARIES
If there are import libraries or packages use these comments above them as a header:
1 | /******************************************************************************/ |
If there is a define then use the header below:
1 | /******************************************************************************/ |
If there is a constant, global or static variable declaration, make sure to comment a description as a header before declaring a global or static variable, the format can be checked below:
1 | /******************************************************************************/ |
Dont forget when declaring a class or function, always provide a description of the type of function or class above it with a comment like this as a header:
1 | /***** PUBLIC CLASS ***********************************************************/ |
If there are other cases, you can still use the header with the format below as a description:
1 | /******************************************************************************/ |
Other example header:
1 | /******************************************************************************/ |
Header for markup languages:
1 | <!----------------------------------------------------------------------------------------------> |
And dont forget to add detail the function/class description above the function/class declaration, the format can be copied below:
CLASS:
1 | /******************************************************************************/ |
FUNCTION:
1 | /******************************************************************************/ |
If there is a sub-description in the function, you can use the header description below:
1 | /*-----------------------*/ |
And if you want to provide a description of the above code use this:
1 | /* description */ |
If you want to provide a description beside the code use this:
1 | YOUR CODE // description |
Provide description for markup languages:
1 | <!-- TITLE --> |
Note: Use end tag if lines are more than 5
NAMING RULES:
The naming rules are largely the same and to make things easier there are three important things to note in naming:
- Type to distinguish each type.
- Data type as a parameter to know the data type of the content after it is declared, besides this it will minimize the occurrence of errors.
- Naming that is easy to recognize and understand (don't use abbreviations that only you and your god know like
x = 5.
First is class, second is function and third is variable.
CLASS
FORMAT: c[Class Type]_[Class Name].[File Extension]
EXAMPLE: cg_Mamal.java (Global/Public Class of Mamals), cs_Car.java (Static/Private Class of Cars)
TYPE OF CLASS:
- g = Global/Public
- s = Static/Private
- d = Data Class
- etc depending on the type programming language
FUNCTION
FORMAT: f[Function Type][Return Data Type][Function Name].[File Extension]
EXAMPLE : fg_tf_checkSquare.c (Global Function with return data type of boolean), fs_mainRun (Static Void Function)
TYPE OF FUNCTION:
- g = Global/Public
- s = Static/Private
- etc depending on the type programming language
VARIABLE
FORMAT: [Type of Variable][Data Type of Variable][Variable Name]
EXAMPLE : g_tf_status (Global Variable with Data Type of Boolean), s_str_name (Static Variable with Data Type of String), c_list_food (Constant Variable with Data Type of List)
TYPE OF VARIABLE:
- g = Global
- s = Static
- l = Local
- c = Constant
- etc depending on the type programming language
There is something else that is important for you to know when creating a name:
- Use these naming rules as a general reference and as necessary, adjust the naming rules to the programming language you are using, because each programming language also has different naming rules.
- Don't write the same name as the keyword (if, else, for, while, etc), because it will create errors and cannot be read by a program.
- Avoid using initials such as using just one letter when naming a variable/function/class if the program is complex, because it will be confusing and difficult to distinguish.
- Do not prefix variable/function/class names with numbers, as this will make the compiler read them as values instead of variables/function/class. Therefore, if our variable/function/class requires a number in it, then the number should not be placed at the beginning.
- Avoid naming variables/function/class with common terms such as data. Naming it data doesn't explain anything. The name will make you confused later. Instead, use a name that describes the value of the variable/function/class itself.
- Variables in Programming Language like JavaScript and etc. can only start with a letter or underscore. You cannot create a variable with a number prefix or use a symbol other than the underscore.
- Variable/function/class names cannot contain spaces. If the variable/function/class name has more than two words, then use camelCase format like this: firstName, lastName, catName.
- Name of variable/function/class must not contain special characters (!, /+*= and others).
Here are some rules for creating a function/class:
- Avoid creating many parameters in a function if they are not necessary. Because if there are too many arguments, it will be difficult to test or use. If there are more than three function arguments needed then it can be consolidated with your team. Instead of creating many function parameters, utilize objects as parameters.
- Make a function to do only one thing because if the function we create does many things, then the function will be difficult to compile and test. Functions that do many things also have no clear purpose. When creating a function that does more than one thing, try to break it down. Until each function actually does one thing. Of course, this also makes the code in the function much cleaner and easier to read.
- The function name must represent its purpose. we also need to pay attention to the naming of the function. Make sure the name given represents the purpose or task of the function. This can also help other developers easily find out the purpose of the function you created.
- Create functions to avoid code duplication. If you feel that you often write repetitive code. You should pay attention to the code. Because repetitive code is a strong candidate for creating a function. The goal is none other than so that the code can be reused, just by calling a function.
CONTROL STRUCTURE & PROGRAM BLOCK
Creating a program block structure that is easy to read is also very important. Apart from making it easier to understand code readability, this can also improve the neatness of code writing. Apart from that, it also makes it easier to carry out line by line testing or makes it easier to check the code by quality assurance.
EXAMPLE:
1 | tf fg_tf_check_nume_inh( void ) |
COMPLEX EXAMPLE:
1 | static tf fs_tf_check_ChangeOfMind( void ) |
CODING/TYPING/WRITING CODE RULES:
Make sure every format, space and indent in every typed program. follow the rules that have been determined as a reference to make it easier to read the code. Use the same structure for classes, functions, if, for, while, etc. (declaration and then opening curly brace { below it and don't forget to close the curly brace } after you finish typing the declaration)
1 | /******************************************************************************/ |
Note: Not all programming languages use curly braces {}, there are programming languages that only need a colon : to declare something and the declaration and completion of the statement is affected by indentation such as in the python programming language.
FOOTER RULES
Make sure that at the end of the file line use the comments below as a delimiter header indicating the end of the file:
Markup Languages:
1 | <!----------------------------------------------------------------------------------------------> |
Programming Languages:
1 | /******** END OF FILE *********************************************************/ |
IMPORTANT NOTE: Make sure to always provide a description with comments to clarify each program flow.
Are you using a mobile phone? If yes, please check the mobile version here to ensure it doesn't look messy.

