15, modify the cultivation of others procedures

xiaoxiao2021-03-06  84

-----------

When you maintain the procedure of others, please don't delete or modify the existing program very residual. I often see that some programmers modify the expression or statement directly on others. When modifying others, please do not delete someone else's programs. If you think that others' programs are not correct, please comment, then add your own handlers, you can't know 100% know the intentions of others, so You can recover, please do not rely on CVS or SourceSafe this version control software, or you want to see you the intentions and steps you modify on the source code. This is when the program maintenance, a cultivated programmer should do.

As shown below, this is a better modification:

/ *

* ----- Comment 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 to use during software maintenance, such a method, can easily maintain the action and intentions of the previous code change, and this is also a respect for the original author.

Modify someone else's programs in the "Note - Add" manner, it is better to delete the procedures directly.

转载请注明原文地址:https://www.9cbs.com/read-107734.html

New Post(0)