copy-and-paste programming
Copy-and-paste programming, sometimes referred to as just pasting, is the production of highly repetitive computer programming code, as produced by copy and paste operations. It is primarily a pejorative term; those who use the term are often implying a lack of programming competence and ability to create abstractions. It may also be the result of technology limitations (e.g., an insufficiently expressive development environment) as subroutines or libraries would normally be used instead. However, there are occasions when copy-and-paste programming is considered acceptable or necessary, such as for boilerplate, loop unrolling (when not supported automatically by the compiler), languages with limited metaprogramming facilities, or certain programming idioms, and it is supported by some source code editors in the form of snippets.
Copy-and-paste programming, sometimes referred to as just pasting, is the production of highly repetitive computer programming code, as produced by copy and paste operations. It is primarily a pejorative term; those who use the term are often implying a lack of programming competence and ability to create abstractions. It may also be the result of technology limitations (e.g., an insufficiently expressive development environment) as subroutines or libraries would normally be used instead. However, there are occasions when copy-and-paste programming is considered acceptable or necessary, such as for boilerplate, loop unrolling (when not supported automatically by the compiler), languages with limited metaprogramming facilities, or certain programming idioms, and it is supported by some source code editors in the form of snippets. A simple example is a for loop, which might be expressed as for (int i=0; i!=n; ++i) {} . Sample code using such a for-loop might be: void foo(int n) { for (int i=0; i!=n; ++i) { /* body */ } } The looping code could then have been generated by the following snippet (specifying types and variable names): for ($type $loop_var = 0; $loop_var != $stop; ++$loop_var) { /* body */ }
Cite this
"copy-and-paste programming". 1785717080. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1367437955 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy