15. self-cultivation of modifying others' programs

Source: Internet
Author: User

-----------

When you maintain other programs, do not delete or modify existing programs. I often see some programmers directly modify expressions or statements in other programs. Do not delete others' programs when modifying others' programs. If you think others' programs are inappropriate, comment out and add your own processing programs, it is impossible for you to know the intention of others 100%. Therefore, to recover, please do not rely on version control software such as CVS or sourcesafe, you still need to view the intention and steps of modifying the program on the source code. This is what a self-developed programmer should do during program maintenance.

As shown below, this is a better method of modification:

/*
* ----- Commented by haoel 2003/04/12 ------
*
* Char * P = (char *) malloc (10 );
* Memset (p, 0, 10 );
*/

/* ------ Added by haoel 2003/04/12 -----*/
Char * P = (char *) calloc (10, sizeof char );
/*----------------------------------------*/
...

Of course, this method is used in software maintenance. This method makes it easy for maintenance personnel to know the actions and intentions of previous code changes, this is also a kind of respect for the original author.

It is better to directly Delete others' programs by modifying others' programs in the form of "comment-Add.

Related Article

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.