Why do you need to add comments to the encoding?

Source: Internet
Author: User
Tags coding standards

Rules are not square. No matter what we do, we must follow certain rules. ForProgramFor members, programming specifications are the top priority. Of course, we should not narrowly understand the programming norms as code standards. The entire software development process must be standardized, and software engineering itself is a kind of specification. Here, I want to focus on the comments in the encoding specification.

In the world of coding standards, annotations play a very important role. So how is the comment important?

 

First, consider it from the encoding's own perspective.

Generally, a project is completed in a day or two. It usually takes weeks, months, or even years. Imagine if you didn't write comments, now let you see what you wrote a few months ago.Code. How much can you understand at once? How long do you need to think back to your thoughts? This is not a waste of time! These can be compensated by writing comments.

 

Second, from the perspective of others.

We write code not only for ourselves, but also for others to understand. Maintenance accounts for most of the software development process. The maintainer may not be the person who originally wrote the code. You may be a master and have a high ability to write code. It should have been a day's work. As a result, you did not write comments and it was half a day. On the surface, it seems that you are working very efficiently. However, you know, it may take two days or even longer for people to understand your code. This is why many people are unwilling to do maintenance work. We always say that as a qualified programmer, We need to always think about our customers. Don't we have to think about it for our fellow citizens who are fighting with us?

 

Finally, from the company's perspective.

If you do not write comments, your work is completed for half a day, saving the company half a day. However, it may take two days for the maintenance personnel to understand your code. You can imagine how much "benefit" you bring to the company "! Q: If you are a company boss, Will you hire such a programmer? Certainly not! Then, such programmers will always be defined as coders. Coon, do you understand?

 

In short, annotations are very important and serve as a bridge between programmers. By the way, it is emphasized that clear code formats and standardized naming are better comments than comments.

 

In the future, we will not become a professional coders. From now on, pay attention to programming specifications and write comments carefully. Let the idea of "thinking for the customer" stay in mind.

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.