An example analysis of using Chinese named identifiers in commercial projects


2020 is doomed to be sad. It is not the best time to change to Chinese naming, because under pressure, it will be more inclined to reduce risks, including using the Old English naming method.

On the other hand, if the transition goes smoothly, at this critical moment, the seemingly insignificant technology of Chinese named identifier may determine the fate of the“Shortening the construction period to 1 / 10” may be a special case, but it is still worth trying compared with the competitiveness improvement brought by the comprehensive risk and technical threshold.

Therefore, although this article is late, I still hope it can be helpful and reduce the burden of the already great pressure. This paper mainly reviews the technical research process of changing the whole stack to Chinese named identifiers in a domestic company last year. Before entering the activity, one suggestion:

  1. If you decide to try, try early. The economic environment is poor. In fact, the time is a little late. It’s best not to wait until the “last fight”. Under the heavy pressure, there will inevitably be various posture deformation and process deviation. Although the threshold of Chinese naming identifiers is not high, it requires a running in process like the adoption of any new technology (such as using a new library, changing to a new service, etc.). Of course, it depends on the courage of the person in charge.
  2. As above, please use all means that can reduce the overall project risk like any other new technology. It includes gradual modification, trial on small projects, avoiding the simultaneous adoption of other new technologies, avoiding large-scale reconstruction of projects, and so on.

After the nonsense, we began to dry the goods.

Research process

The first, of course, is to understand the needs. One of the company’s main businesses is to customize management software (based on internal framework) for the production process of manufacturing enterprises. When communicating with the person in charge of the company in the middle of April last year (2019), I learned that in the customization process, translating Chinese terms into appropriate English will reduce the fluency of customization. Therefore, it is suggested to use Chinese naming instead of this translation. Another incidental advantage is that after being handed over to users, users can also directly develop in Chinese, which is more convenient for their users.

Then understand the internal framework used by the company. The version numbers of externally dependent frameworks and tools are as follows:

  • java 1.7.0
  • mysql 5.5
  • tomcat 7.0.77
  • eclipse Kepler Service Release 1
  • hibernate 3.3.2 GA

So I quickly made a back-end in a similar environmentdemonstration, Chinese names are used in Java and mysql. (about three or four days before and after amateur)

Due to various delays, we contacted again a month later. First, learn more about the details of the framework. The current situation is that in the database, the table name is English, and there will be a Chinese label, such asSysUserGroupAuthority, the Chinese label isUser group permissions。 After naming in Chinese, the table name can be directly named in Chinese. The company’s internal framework made a restriction on naming at that time – it must be in English. Ideally, if this restriction is released, it can be named in Chinese.

After the above demonstration, it is basically determined that the table name, field name, index name, corresponding Java class name and attribute of the database can be named in Chinese.

Next, start to investigate the front end. Let’s start with a front-end example (webpack), which has some business-related parts.

In two hours, the identifier and string in the forms part of the client example are stored in the culture. The following is git log. It can be seen that the previous method is also adoptedChinese Vue timeThe order of class name before internal:

Date:   Tue May 21 00:07:27 2019 -0700
    Variable method rename

Date:   Tue May 21 00:01:55 2019 -0700
    Rename path datasource - > datasource

Date:   Tue May 21 00:00:00 2019 -0700
    Rename path base - > Basic

Date:   Mon May 20 23:57:04 2019 -0700
    Rename path sysuser - > system user

Date:   Mon May 20 23:08:48 2019 -0700
    Forms_ System user_ Basic data source_ System user attribute rename

Date:   Mon May 20 23:06:43 2019 -0700
    Rename class form_ Sysuser - > table_ System user

Date:   Mon May 20 23:04:42 2019 -0700
    System user_ Mixed domain attribute rename

Date:   Mon May 20 22:59:51 2019 -0700
    SysUser_ Fieldsmix - > system user_ Mixed domain

Date:   Mon May 20 22:57:07 2019 -0700
    Rename class form_ SysUser_ DataSource_ SysUser

Date:   Mon May 20 22:51:27 2019 -0700
    Rename class form_ SysUser_ DataSourceBase_ SysUser

Date:   Mon May 20 22:44:43 2019 -0700
    Rename class formbase_ SysUser

Date:   Mon May 20 22:40:49 2019 -0700
    Change property name

Date:   Mon May 20 22:34:20 2019 -0700
    Modify string content

So far, the technical verification has been basically completed, and the missing link is the front and rear communication part. There are two options. One is to use a prototype for verification similar to that before; The second is to use the minimum cost for full stack verification in the actual code.

The first choice is: 1) it takes a certain amount of work to build a front-end and rear-end communication prototype and verify the function; 2) It is still difficult to fully achieve the effect of actual code verification

The “minimum cost” of the second option means that in the actual code, after removing the naming restrictions on node names, only one Chinese node is added, and the front and rear ends are modified accordingly to check whether all functions are normal. It depends on the difference between this workload and the workload of the first choice. If there is no big gap, I think the second option will be more appropriate. This has also been recognized by the person in charge of the company.

After that, it is understood that the company intends to try in appropriate projects. The last contact was at the end of last year. I heard that the technology stack was being replaced. It is planned to add Chinese naming support this year (2020). Wait and see.


Although the research process has a large span, it does not take much time (together, it is about more than a week). During this period, some naming related problems were found and reported to the person in charge:

  1. In a sense, naming in Chinese needs more deliberation than naming in English. Because when Chinese naming words fail to express their meaning, the visual effect will be more obvious than English. For example, “sysusersetformtype” – > “screen custom type”, in English, it is more like “user-defined table type”? Of course, it will be convenient in the future if it has a good name at the beginning.
  2. The terms should be consistent as much as possible (it is better to document the glossary), which is similar to English naming. For example, “table” is “table” in several labels, but “importtable” turns to “data import” instead of “import table”, and “numseqtable” is “list”.

Now I think the naming should be derived from the requirements document.

This article is only to throw a brick and attract jade. If you have any questions about details or encounter problems caused by Chinese in your attempt, you are welcome to let us know and will do your best.