http://kyagrd.dyndns.org/wiki/GeneralizeOrGenerate CopyAndPaste is the axis of evil in programming. Never end up with CopyAndPaste, but GeneralizeOrGenerate. A routine for a certain task must be unique throughout the program. Redundant code fragments doing the same work should be pulled out and merged into a single subroutine. If it is difficult to extract a common subroutine in the current programming system, then programmer should use a code generator to generate them from a single template. ''He could also consider using a language with better support for abstraction than his current one.'' Mathematicians' works looks so marvelous because they solve a particular problem by solving much more general problem which seems to be more difficult and applying the general solution to the particular problem. This kind of approach is a certified method throughout the history of mathematics. The advantage of this kind of method is that it can easily solve many other related problems as well as the particular problem it had intended to solve. Programming is not much different from solving a problem in mathematics. A good program in programming is a general program that can handle a particular task as a special application of its ability to handle a general kind of tasks, as a good solution in mathematics is a general solution that is applicable to a particular problem. These kinds of programs are useful because of its wide usage and flexibility in further improvements. However, this obvious fact is often ignored in the field. Many programmers tend to pour out poor programs that barely manage to solve the particular problems only, in the excuse of urgent due dates or whatsoever. CopyAndPaste is the most common temptation in programming, especially when solving a problem similar to some other problem solved before. It is a very bad atmosphere that allows or even forces the programmers to the code and editing it in an ad-hoc manner without feeling guilty at all. Let's throw away CopyAndPaste habits and do GeneralizeOrGenerate. There might be troubles for the programmers in the field, such as project planning just to show off or bad business custom like madly accepting orders without listening engineers' opinion. Even so, giving in to the bad situation will only block the progress of the organization as well as the individual. It is the manager not the developer who is responsible for problems such as insufficient due dates. The quality of the program is what engineers should be loyal for. ------ See also: CodeGeneration, CodeGenerationIsaDesignSmell