The pragmatism of TDD practice

Source: Internet
Author: User

1. Choose a language for communication

We have encountered problems in the development of a seafarer management system, and the terminology of this field is difficult to translate. Even reluctantly translated, also feel Bundas, whether it is at first look, or after a period of time to see all confused. For example, we wrote the following test cases:

public void test_should_return_NOT_pass_if_duty_higher_than_second_mate_or_second_ engineer_and_education_level_is_secondary_and_guraduated_after_2002_02 _01() {
  ……
}

But what does second Mate/second engineer mean? What exactly is the education level of secondary?

And also:

public void test_should_return_third_mate_course_for_jianxi_third_mate() {
  ……
}

What is Jianxi_third_mate? Wait a minute.

Of course, we can make a glossary, ask a professional to help us translate it well, and then follow the glossary in the code. However, with the increasing demand, the terminology is endless, and there is no corresponding translation of nouns with certain Chinese characteristics, so this problem has been bothering us.

And then one day, in a refactoring, we renamed the first test case above, and everything seemed suddenly cheerful:

public void test_应该算未通过_if_职务高于二副二管轮_而_学历只 是中专_并且_毕业时间晚于2002年2月1日() {
  ……
}

The team gathered around and looked at the name of the test case, which was almost identical to the acceptance criteria in the requirements description, and felt an unprecedented clarity. It was almost a matter of seconds before the choice was made: This form was acceptable, and the expression was stronger and the communication worked well.

What do you mean? Use Chinese as a function name? This seems to be only those who are despised by the mainstream public opinion "the Chinese programming" the researcher only then does the thing, we have been educated from these things far away, even Hanyu Pinyin is not recommended to use, one often take to do a negative example is the list of database table using Hanyu Pinyin, which is seen For unprofessional performance. Or, what about joining a foreign developer in a team?

Luckily, we are software engineers, not computer scientists. Academic theory can be extreme, and engineering must be some kind of compromise. Theorems are accurately observed by nature, but engineering is an artificial balance of various stresses.

Specifically to this case, let us face the reality:

Team members are not long in this project field of professional English.

Any translation will cause a certain loss of information, especially in some areas with Chinese characteristics, such as "secondary" translation of English can hardly be as simple and intuitive as Chinese.

There will be no foreigners joining the development team for the foreseeable future.

And the choice of Chinese but can let us better adhere to the following principles:

In addition to completing the function, another important function of the code is communication. (We chose the most effective way to communicate with the team)

Use the name of the test case to describe the requirement. (more accurate in Chinese description, easy to understand)

Of course, we also lose something, such as the above mentioned "should adhere to the use of English" principle of abandonment. Here we think the benefits of abandoning this principle outweigh the losses. A loss is to lose the opportunity to learn English, such as the last Test case above, written in Chinese is:

public void test_见习三副应该参加三副的培训() {
  ……
}

Or someone will say: "Probation" English is "intern", commonly used words ah. However, there is another kind of role in the system, called "internship Three", that is "intern". Internship is the actual hands-on, take the actual responsibility, the probation is only to see not practice, follow the study in the back. The English word for the internship is "noviciate" and is not familiar to the project team, and we no longer care about it.

In short, in practice you should weigh various pros and cons and choose the most effective way for you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.