Talk:Copy-and-paste programming: Difference between revisions

Content deleted Content added
No edit summary
Cewbot (talk | contribs)
m Maintain {{WPBS}} and vital articles: 1 WikiProject template. Create {{WPBS}}. Keep majority rating "C" in {{WPBS}}. Remove 1 same rating as {{WPBS}} in {{WikiProject Computer science}}.
 
(24 intermediate revisions by 14 users not shown)
Line 1:
{{WikiProject banner shell|class=C|
== Neutrality ==
{{WikiProject Computer science|importance=Low}}
Obviously, I agree that "It is a common mistake of the inexperienced or lazy programmer to duplicate code instead of writing a set of methods or objects", but unfortunately, this statement is obviously heavily biased and unattributed, and hence a violation of Wikipedia's "Neutral Point of View". My approach, when I did the reorganization of this article, was simply to dispassionately describe the problematic programming practices in the "Forms" section, and then to address the difficulties they create, with references, in the "Effects" section.
}}
[[User:Rnickel|Rnickel]] ([[User talk:Rnickel|talk]]) 16:43, 22 July 2008 (UTC)
 
== Expanded, organized, referenced ==
I have expanded this section's discussion of copy and paste programming by experienced programmers, and rather than having it as one continuous block of uninterrupted text, I've rearranged much of the text to create two distinct major sections. Also, I have added a number of references. I believe this article now qualifies for removal of the "no references" designation, as well as the "stub" designation.
[[User:Rnickel|Rnickel]] ([[User talk:Rnickel|talk]]) 16:43, 225 JulyJune 2008 (UTC)
 
== sweeping changes ==
Line 43 ⟶ 42:
 
This article still seems strongly slanted against copying and pasting, ever, in programming. I've tried to remove some of that bias. [[User:Mathiastck|Mathiastck]] 23:32, 23 May 2007 (UTC)
 
== Neutrality ==
Obviously, I agree that "It is a common mistake of the inexperienced or lazy programmer to duplicate code instead of writing a set of methods or objects", but unfortunately, this statement is obviously heavily biased and unattributed, and hence a violation of Wikipedia's "Neutral Point of View". My approach, when I did the reorganization of this article, was simply to dispassionately describe the problematic programming practices in the "Forms" section, and then to address the difficulties they create, with references, in the "Effects" section.
 
The fact that there has already been a change of "looping" to "set of methods or objects" is absolutely indicitive of the problem: there is no one single solution to bad programming. The general antidote is good decomposition, but what that will look like depends entirely on the programming methodology being used: procedural models will take a different approach than object oriented models for example.
[[User:Rnickel|Rnickel]] ([[User talk:Rnickel|talk]]) 16:43, 22 July 2008 (UTC)
 
== Loop unrolling etc ==
 
I reverted the good-faith edits made by 95.199.24.203 due to a number of problems with tone and sourcing:
* The tone was non-encyclopedic; it sounded conversational and read more like personal opinion.
* There were no sources for any of the statements; a number of them appeared to be [[WP:OR|original research]].
* There were several grammatical errors.
 
I did preserve the mention of loop unrolling, since that seemed to me to be the most significant point raised. There could be further discussion of loop unrolling in the body of the article, although the statement that it is "a common practice to gain speed increase on modern computers" is egregiously untrue. In fact, manual loop unrolling has become all but extinct in the modern era as improvements in compiler technology have removed the need for programmers to pursue these types of "speed hacks".
--[[User:Rnickel|Rnickel]] ([[User talk:Rnickel|talk]]) 17:33, 30 July 2013 (UTC)
 
== Writing swap by hand is common? Where exactly? ==
 
The paragraph http://en.wikipedia.org/wiki/Copy_and_paste_programming#Example claims that
 
"While this can be abstracted into a macro or a function, this adds considerable overhead and reduces readability of the code (see snippet example), as this is a common idiom."
 
This needs citation, and it is not true. In the C++ community, for example, it is common to use the std::swap-function. Even more, when writing classes, it is common to provide non-throwing swap functions. Even more more, std::swap is assumed to not throw and used as the foundation for enabling exception save code.
 
Handwriting swap is totally counterproductive in C++ and textbook saying you should handwrite should be thrown away.
 
* It is less readable than the word "swap"
* It opens loopholes in a program's exception safetyness
* It comes at a performance cost because the manual version uses an additional copy of the complete datastructure (think in Megabytes or more), where under the swap-API only the interal pointers have to be swapped
 
[[User:Phresnel|Phresnel]] ([[User talk:Phresnel|talk]]) 15:22, 20 August 2013 (UTC)
 
=== Update ===
 
I replaced the example with a more neutral one. Should the original author of that uncited claim by uncomfortable with my change, then she/he may please use citations to prove that manually writing swaps is common, because for at least a huge subset of the programmer folks, it isn't ( http://langpop.com/#normalized ).
 
 
[[User:Phresnel|Phresnel]] ([[User talk:Phresnel|talk]]) 15:35, 20 August 2013 (UTC)
 
=== Gif animation ===
I've made a simple animation to show one of the problems of C&P programming: when original code block contains error, all copypasted blocks will contain this error too and the fixing the bug will not be a trivial task (in gif programmer accidentally forgot to change some code blocks). Do you have any notes for animation? Do you have any objections not to include animation to article? Waitnig for feedback. --[[User:Atroshko|Atroshko]] ([[User talk:Atroshko|talk]]) 06:54, 7 December 2013 (UTC)
[[File:Forgotten edits in copypaste programming.gif|thumbnail]]
 
== POV issues ==
 
This article contains express terms connecting "copy-paste" and "snippet" usage as indications of inexperience or lack of proficiency in programming and editing operations. This position is not substantiated by any citations, and it also seems to ignore that experienced and highly proficient programmers use such methods as a simple means of saving keystrokes and reducing the risk of repetitive strain and other occupational hazards experienced routinely by professional programmers.
 
Moreover, this position seems to ignore the obvious fact that *most* professional-grade editors and IDEs contain support for some kind of abbreviation or snippet management, precisely because there is demand for this among programmers and other professionals who do not wish to manually type boilerplate and needlessly repetitive data entry.
 
[[User:Dreftymac|dr.ef.tymac]] ([[User talk:Dreftymac|talk]]) 15:32, 30 May 2014 (UTC)
 
While I was reading this article, I kept thinking of a couple of projects I was working on in [[C (programming language)|C]] using [[X Window System|X Windows]] on [[Unix]] in the early [[1990]]s. For the user interface, the first two things I wrote a generalized string input routine, and the second thing was a generalized menu routine (that would read the menu from a text file, so you could change the menu without recompiling the program). I spent the best part of a year cheerfully plugging those two routines into well over a dozen programs on several wholly different projects and it saved me whole bunches of time. [[User:JHobson3|JHobson3]] ([[User talk:JHobson3|talk]]) 17:11, 18 August 2016 (UTC)
 
== External links modified ==
 
Hello fellow Wikipedians,
 
I have just added archive links to {{plural:1|one external link|1 external links}} on [[Copy and paste programming]]. Please take a moment to review [https://en.wikipedia.org/w/index.php?diff=prev&oldid=686168507 my edit]. If necessary, add {{tlx|cbignore}} after the link to keep me from modifying it. Alternatively, you can add {{tlx|nobots|deny{{=}}InternetArchiveBot}} to keep me off the page altogether. I made the following changes:
*Added archive https://web.archive.org/20080516005005/http://www.stanford.edu/class/cs106x/handouts/14-Decomposition.pdf to http://www.stanford.edu/class/cs106x/handouts/14-Decomposition.pdf
 
When you have finished reviewing my changes, please set the ''checked'' parameter below to '''true''' to let others know.
 
{{sourcecheck|checked=false}}
 
Cheers. —[[User:Cyberbot II|<sup style="color:green;font-family:Courier">cyberbot II</sup>]]<small><sub style="margin-left:-14.9ex;color:green;font-family:Comic Sans MS">[[User talk:Cyberbot II|<span style="color:green">Talk to my owner</span>]]:Online</sub></small> 13:05, 17 October 2015 (UTC)
 
== Testing ==
 
Unit test code is an example where copy-and-paste programming may be acceptable. Could cite https://mtlynch.io/good-developers-bad-tests/ as a source, if deemed reliable enough. [[User:Syneil|Syneil]] ([[User talk:Syneil|talk]]) 09:20, 17 March 2021 (UTC)