Something that is often done and often thought of.
Obscure if condition
1) for | | The processing
The code above will take more time than the following code.
Although reducing the number of lines of code is a good goal, minimizing the time required to understand the code is a better goal.
return value
The "$ret" above is an alibi for "I can't think of a name." Instead of using such empty names, pick a name that describes the value or purpose of the entity.
$alias declares that this variable is used to host aliases-The purpose of this variable is indicated. And it could help us find a flaw.
A good name should describe the purpose of the variable or the value it is carrying.
Temp variable
The $i here is "my temp variable", which is designed to automatically increase statistics and avoid duplication of statistical points. But the most important thing for this $i is not temporary variables. Using Charset_index to represent "subscript for my statistics" is more descriptive.
Loop iterator
I also found a bad taste in my JS code.
I variable name is very vague, so do not do so.
Names like I,j,iter and it are commonly used for indexing and looping iterators. Although the names are vague, everyone knows that they mean "I am an iterator". You actually use these names to express other meanings, which can be confusing. So don't do this.
If you have to use i,j,it such a vague name, then you have a good reason to convince yourself.
Summarize
In the process of coding, it takes a few seconds to come up with a good name, and you will find that our "naming ability" is quickly lifted up.
I usually first think of the Chinese name, if I can not think of the corresponding English name, I will use the translation tool to put the thought of Chinese paste up, and then to crop the name of the variable or function names.
Give me a nice name that I've seen recently.
http://www.bkjia.com/PHPjc/325648.html www.bkjia.com true http://www.bkjia.com/PHPjc/325648.html techarticle often-done and often-wanted things obscure if condition 1) for | | The processing of the above code is more time-aware than the following code, although reducing the number of lines of code is a good goal, but ...