Related Illnesses

 < Day Day Up > 



The other illness that contributes most to the CAP Epidemic is Myopia. Cut-and-paste represents a quick-and-dirty short-term solution, but inevitably leads to problems in the long term. A greater focus on the long-term effects will reduce the amount of cut-and-past as the detrimental effects become obvious. Another contributor to code duplication is NIH Syndrome. Even if you are duplicating the functionality of code that is not developed in-house, the resulting effects of having two copies of the code can still rear its ugly head. Another programmer might decide to use the third-party algorithm, and then you will end up supporting two sets of code that do the same thing. The next chapter takes an in-depth look at this and other results of NIH Syndrome.

Using cut-and-paste when building the basis for the application leads to a brittle framework that is an occurrence of Brittle Bones. Changes become difficult, and as functionality is built on top of the framework, it uses different instances of the same functionality. Future changes to one instance but not the others can cause surprising results. Another illness that often manifests by accident when using cut-and-paste is i. This results from the placement of code into a new context without updating the variable names, which leads to poorly named variables that can mislead another programmer reading the code. A myopic solution to this is to ensure that you update the variable names, but a much better ultimate solution is to avoid the duplication of code altogether.



 < Day Day Up > 



Preventative Programming Techniques. Avoid and Correct Common Mistakes
Preventative Programming Techniques: Avoid and Correct Common Mistakes (Charles River Media Programming)
ISBN: 1584502576
EAN: 2147483647
Year: 2002
Pages: 121
Authors: Brian Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net