6 Important Tips for Unity Variable Naming

Hongliu Academy will make you a few steps faster.
The content of this article comes from the selected content of Hongliu Reading Club.

The naming of variable names is a technology and an art, and a good name is very important.

6 Important Tips for Variable Naming

1. Good variable names are a key element in improving program readability. Special considerations are required for special kinds of variables, such as loop subscripts and state variables.

2. The name should be as specific as possible. Names that are too vague or too generic to be used for more than one purpose are generally bad names.

3. The naming rules should be able to distinguish local data, class data and global data. They should also be able to distinguish between type names, named constants, enumerated type names, and variable names.

4. No matter what type of project you are doing, you should adopt some kind of variable naming convention. The type of rules you use depends on the size of your program and the number of project members.

5. Abbreviations are rarely used in modern programming languages. If you do use abbreviations, use the project abbreviations dictionary or standard prefixes to help understand abbreviations.

6. The code is read far more times than written. Make sure you choose names that focus more on readability than writing convenience.

further reading

[Extended Learning]读书会 You can read all articles in this series by replying to the official account of Hongliu Academy


I'm Dazhi (vx: zhz11235), your technology pathfinder, see you next time!

don't go! Like it , collect it!

OK, you can go.

Guess you like

Origin blog.csdn.net/zhenghongzhi6/article/details/110917148