Three-year 0 fault summary, tips for improving code quality

Source: Internet
Author: User

Personal experience

The biggest impact on my code quality is in a foreign-funded enterprise, in this company I think there are several aspects of doing very well.

    • Unified Team Coding Style
      • What is the level of unification? Without looking at the author of the code, it's hard to tell who wrote the code (and some of the company's teams are able to meet this standard at the moment).

Personal Opinion:

    1. What is the benefit of doing this? It's easy for everyone on the team to read code, to reduce the amount of communication, maintenance costs (the number of code reads is much greater than the number of changes), and the mood is very pleasant. Some people must think that pleasure is a little exaggerated, for a chestnut: there is some code, if it is not related to the content of the work, you have a life is reluctant to touch its feelings. But there are some code that reads down the one go and feels comfortable, prompting you to continue reading (and you don't want to spoil the idea of unification).
    2. the more unified the basic level, the higher the efficiency (not only refers to the uniform coding standard, but also the basic principle of doing things). For a chestnut: Our team has stipulated that individual weekly reports must be issued every Friday before going to work, otherwise a fine of $10. The late onset of the group's Weekly report was more prominent, the rules were out, and obviously improved (the absence of the meeting was also significantly improved). Is it not very reasonable to pay the penalty? How much does it make sense to write a note? Rather than devote a lot of energy to discussing these perfunctory problems, it is better to standardize them in time (the norm will not be poor) and strictly enforce them. Follow up on issues even if you make adjustments. The key is unification and strict enforcement.
    • Code Simplicity
      • Do not write 2 lines (without affecting readability) If you can resolve 1 lines.
      • Unnecessary code (such as comment code or meaningless) must be deleted

Personal opinion: We all know, there's nothing to say.

    • Codereview
      • The team's PLA (Team Backbone) is Codereview, and the Code quality Awareness/and code specification between PLA in the team is very uniform. There will not be a team, multiple standard cases
      • Five weeks a week will review the code review this week and come to a conclusion. Place the example on the wiki for a reference to a similar problem later on. New students can also refer to this content to learn the norms, to avoid committing similar problems. Many of the content in the specification is so cumulative.

Personal Opinion:

    1. I was in a team that Ali experienced, the PLA has 3, 4, respectively responsible for each piece of business. There are few codereview between PLA, and there seems to be little awareness of code quality. But the general development of the team of the students in the Codereview between the PLA, the code quality of the evaluation standards vary greatly. This can lead to 2 phenomena: development tends to review loose classmates, because loose review find the problem (not only bug) less, the change cost is small, there will be no change caused by the failure risk, will not affect the project progress (but the subsequent maintenance and communication costs will increase significantly); another phenomenon, Development of doubts to different PLA, Uniform code quality standards between PLA, consensus within the team and documentation, as a follow-up reference.
    2. the quality of a team's code depends primarily on the team's PLA, which advises the team to unify the PLA's Code quality awareness and specifications early in the first . For example: first by 1-2 PLA for the entire team development to do review, this review workload will be very large, and team productivity is not high, but the latter review workload should be significantly reduced, the code quality will be significantly improved, the team's efficiency will be significantly improved.

      I am in the foreign company this firm just entered the one months is my most painful one months, was codereview feeling very uncomfortable: and previous coding habit difference is big, review too strict (variable name, blank line, note has the word grammatical error will also correct), feel limited encoding freedom .... 1 months later realized the obvious benefits: fewer coding bugs; Less communication, code and annotations have solved most of the questions; Reading code is highly efficient; Feel the code written by others as if they write, very intimate. One months later, revew My code of PLA obviously relaxed the content of my review, because he has not review problems for many times, and let me in every review before I told the focus review content can be.

    • Execution force and pressure
      • Once the Codereview comes to a conclusion, it will be executed immediately. If there is doubt, you can continue the discussion until the conclusion is reached. The content in the specification can be improved, but once the norm is formed, it must be strictly enforced.
      • Once an irregular code is submitted, it will be emailed to the team PLA and the boss, the number of reminders or continue to make similar problems, and even will be discouraged.

Personal Opinion:

    1. Some of the departmental codes I've been through in Ali are pretty good, but some of them are relatively loose in their execution. Because the project progress is tight, the code quality is easy to compromise, the common phenomenon "I will change the next version", "This should be no problem", "This code is not done according to specifications, but change the risk is too big, what to do". At this point, if you compromise here, the Basic code specification will be difficult to maintain. Because once the ugly code is online, the code is likely to spread across the project (similar to the broken window effect).
    2. Many people have a strong sense of code quality/specification, but a few may feel less obvious or have not realized the benefits of these, or have a habit of their own differences with the rejection of the heart, this time with external pressure to stimulate. For example, as mentioned above every Friday review-week problem-no one would like their code is often carried out as a negative example. Forcing him to go forward, to do the right thing to the wrong person. New people may feel more stressed about stress, and stress can push you to be more cautious and likely to make you cringe, and be more concerned about new people.

To read the full text, please click: http://click.aliyun.com/m/8717/

Three-year 0 fault summary, tips for improving code quality

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.