Copy and paste in software development

J

jacob navia

I think nobody here can deny that copy and paste is an established
method of software development.

You know: you have some code that works, and you want to modify it. You
copy it and paste the code somewhere else, then you modify it leaving
the running code in its place until you switch to the new version.

True, many people are against this fashion of developing software. The
correct (in the abstract) process should be of finding out the common
parts of the code and isolate the changes as far as it is possible,
maintaining a common line.

The copy/paste is considered harmful.

But... I was surprised when I read this article in PLOS: [1]

<quote>
One of the primary agents of genome evolution is gene duplication.
Duplicated genes provide the raw material for the generation of novel
genes and biological functions, which in turn allow the evolution of
organismal complexity and new species. James Sikela and colleagues set
out to compare gene duplications between humans and four of our closest
primate relatives to find the genetic roots of our evolutionary split
from the other great apes. Collecting the DNA of humans, chimpanzees,
bonobos, gorillas, and orangutans from blood and experimental cell
lines, the researchers used microarray analysis to identify variations
in the number of copies of individual genes among the different species.
They analyzed nearly 30,000 human genes and compared their copy numbers
in the genomes of humans and the four great apes.

Overall, Sikela and colleagues found more than 1,000 genes with
lineage-specific changes in copy number, representing 3.4% of the genes
tested. All the great ape species showed more increases than decreases
in gene copy numbers, but relative to the evolutionary age of each
lineage, humans showed the highest number of genes with increased copy
numbers, at 134. Many of these duplicated human genes are implicated in
brain structure and function.

The gene changes identified in the study, the authors conclude, likely
represent most of the major lineage-specific gene expansions (or losses)
that have taken place since orangutans split from the other great apes,
some 15 million years ago. (Humans diverged from their closest cousins,
the chimp and bonobo, roughly 5 million to 7 million years ago.) And
because some of these gene changes were unique to each of the species
examined, they will likely account for some of the physiological and
morphological characteristics that are unique to each species.

<end quote>

Apparently the programmer (or programmer team) 15 million years ago were
in a hurry. And copy / paste, as everyone here knows, is not an accepted
method but... it works, and that is all that counts.

All those millions of years later, the descendants of those apes start
to wonder...

WHAT HAPPENED?
 
S

Spiros Bousbouras

I think nobody here can deny that copy and paste is an established
method of software development.

You know: you have some code that works, and you want to modify it. You
copy it and paste the code somewhere else, then you modify it leaving
the running code in its place until you switch to the new version.

True, many people are against this fashion of developing software. The
correct (in the abstract) process should be of finding out the common
parts of the code and isolate the changes as far as it is possible,
maintaining a common line.

The copy/paste is considered harmful.

I think copy and paste is fine especially if you have a
small library which does one thing well and modify it
to fit better in new circumstances. The modifications
may be quite small like how to handle errors or whether
to read new data from an array instead of from a file.
Furthermore copy and paste is almost indispensable on
some occasions because C doesn't have powerful macros.
Certain code patterns are hard to abstract over using functions.
But... I was surprised when I read this article in PLOS: [1]
S n i p a r t i c l e

Apparently the programmer (or programmer team) 15 million years ago were
in a hurry. And copy / paste, as everyone here knows, is not an accepted
method but... it works, and that is all that counts.

If you want to find biological examples where "copy
and paste" works you can do better than gene
duplication: http://en.wikipedia.org/wiki/Exaptation
 
L

Larry Gates

I think nobody here can deny that copy and paste is an established
method of software development.
Apparently the programmer (or programmer team) 15 million years ago were
in a hurry. And copy / paste, as everyone here knows, is not an accepted
method but... it works, and that is all that counts.

Look how much value a cut and paste snippet is, in particular,
alleinstehedende Programme:

Larry Gates said:
I have this as a leftover part from previous inquiries:

foreach my $elem ( $tree->find_by_attribute('name', 'jd') ) {
print $elem->attr('value'), "\n";
}

This will get me the julian time from this point north and west of the
cosmopolitan of yakutsk. How do I instead, give IT the julian time from a
perl script?


perldoc -q form

How do I automate an HTML form submission?

<center><h1>Sky above 65N 90E at Sat 2009 Feb 14 4:33 UTC</h1></center>
<center>

How do I grab what lies between the center tags?


------------------------------
#!/usr/bin/perl
use warnings;
use strict;
use HTML::TreeBuilder;
use LWP::Simple;

my $site_url = 'http://www.fourmilab.ch/cgi-bin/Yoursky';
my $url_args = 'z=1&lat=35.0836&ns=North&lon=106.651&ew=West';
my $t = get "$site_url?$url_args" || "Problem";

my $tree = HTML::TreeBuilder->new_from_content($t);

foreach my $elem ( $tree->look_down('_tag', 'center') ) {
print $elem->as_text(), "\n";
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top