Please comment out your damn code

Source: Internet
Author: User
I stood up to say: please comment out your damn code. Every time I meet a programmer & mdash; sometimes it is quite high & mdash; I always find that you do not need to add comments to your code. That's all nonsense. I have been saying this for a long time. The problem is... "> <LINKhref =" http://www.php100.co

 

I stood up to say:

Please comment out your damn code.

Every time I met a programmer -- sometimes quite high-level -- I always found that you don't need to add comments to your code. That's all nonsense. I have been doing this for a long time. The problem is that it is harder to make things change than you think. Although we are at a crucial moment trying to write annoying code and prepare to release some amazing new things, we are still commenting on almost all the things in the east. There is no excuse not to do these things. Every 3 to 7 lines of code, you can see a long editorial. Sometimes, in hundreds of lines of code, you can find a good joke.

Hidden Places of errors

See, one is what you want, and the other is what you implement. Your bug lies between the two. If you write a comment, you are telling me what you want. Your code tells me how you do it. Program defects either exist in the idea you want, or the requirement is correct, and your code has problems. Please help me and let me know what is wrong.

Do not be lazy

A common objection is: I have heard that comments often expire because the code is updated frequently, but the comments do not. Do you not update comments? Are you a colleague? Do not be lazy. do not create a cultural atmosphere that makes people think that it is indifferent to being lazy. Tell your colleagues how you meticulously annotate the program and let them know that you want them to do the same. It is only an excuse to say no to comment out because it is afraid that someone or some places will cause your mistakes in the future.

You are an experienced person

People are ignorant. this is natural, but you are experienced. Therefore, you are obligated to educate those who need to learn. Your comments will guide those who are reading your code. Tell them why the Tuple data structure is used here, rather than the others (it is better to append a link on stack overflow or dotnetperls... You can do this, right ?) What shortcuts have you taken here? If you don't take shortcuts, you won't be able to release them on time, so tell these new users about the special situations you encounter. Otherwise, your bad code will eventually be copied and spread around. Look! The code you wrote turns into a program template of the company! No comments!

You can type

Some of my recruitment processes are whiteboard programming and some are keyboard programming. All the good programmers are good at typing. It means that you can play 40-60 words every minute. Please tell me, why don't I add a comment when writing code like a machine gun? Of course, you can spend 30 seconds to tell me that this mess of code writing is because the guy who is engaged in business needs to release the program this week and returns a huge $75 thousand. But what about next month? Are these codes gone? Stored in the stone? I know what the code is. But please tell me your intention.

You get older

I have been programming for a long time, maybe before you go to middle school. I am still programming, and I still like programming. One day, you will become as old as me. If you are like me (at that time I was unable to educate you again), there were too many layers, too many abstractions, and too many technical architectures that you could not fully remember. Your comments will guide you. They will tell you that six months ago, you were using this method, this mode, and it was just to show off. If you are a really good programmer who is still programming, you will realize that the code is poorly written and you need to implement it again in a different way. You still have your comments to remind you of your thoughts and why.

So please comment out your damn code.

[Link to the original English article: Comment your damn code]

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.