This seems a bit like the old "buy vs. build" debate. (This is strongly related, though it does stray somewhat -- in any event, it's still in the same "thought mode".)
I'm solidly on the "buy" side of things. If I can purchase the functionality that I need (e.g. to cut down the time to market), then I will. I think that there are significant benefits to buying:
- You're likely not an expert in the subject -- Buying gets you an expert
- Time to market -- Much faster
- Resources can be used elsewhere
- Don't reinvent the wheel -- ok - not a benefit, but all the same...
The first there is what I think is the most important. Here's an example.
Imagine you're going to write a simple MP3 player. Well, in order to do that, you need to have an MP3 decoder to decode the encoded data in MP3 files (sorry about the verbosity there). Now, you *could* write one, but why? It is a non-trivial thing to do any kind of compression, and especially complex compression like MP3. The chances of you being able to actually create an MP3 encoder or decoder that even begins to approach the level of the Fraunhoffer or LAME (RareWarez) MP3 software is highly unlikely. There are many casualties there that attest to it, e.g. Xing and Blade. The only real solution is to use an existing MP3 codec.
The same thing goes for pretty much all encryption and all compression. Both those are extremely technical fields where the level of expertise required is simply massive.
Actually, I'd go so far to say that unless someone is an expert in the area of cryptography (or a mathematical savant), if they attempt to write cryptography software, they are not merely a complete fool, but completely irresponsible and totally wreckless. That can be extended to other areas in security as well.
Ok, well to sort of get somewhat back on topic...
I think the same principle applies to learning as well. If you repeat things long enough (copy & paste), eventually it's going to sink in.
A lot of things are merely matters of logic. Those you really need to be able to tackle with brain power. But a lot of things aren't a matter of logic at all; they're matters of knowing completely arbitrary rules.
For example, looping structures are all pretty much the same and follow the basic structure:
Loop
...do stuff...
End Loop
An exit condition is either at the top or bottom, and possibly in the 'between' part. There's no point to copying & pasting that. You need to know it flat out.
The same goes for conditional structures, e.g.:
If... then... elseif... else...
Or
switch... case 1, case 2... (or select case)
But things like opening a file or writing out an XML serialization are completely arbitrary with no predictable pattern. That is, they are always language specific, even if different languages are significantly similar.
Those things you really need guidance in using. A small set of rules won't help you in many cases.
Asynchronous calls are another area where you just have to roll with what you're given. Callbacks or events or delegates or whatever they're called... The ways to get them done differ significantly in different environments. The only thing you can really do is know when to use them and when not to use them. Doing networking? Well, you probably need to use non-blocking methods, or asynchronous calls.
Some concepts don't even exist in some languages, so you have to work your mind around the new way and come to terms with it. After that, you're good to go but you'll likely need to do some copy & paste along the way until it's familiar enough to just write it out.
Still... Yeah... I can totally see how blindly copying & pasting can be one of the worst things you can do. Understanding something doesn't mean being able to do it though. But if you can get that basic understanding about what things are for, then try to be responsible in copying & pasting, it seems like a good way to get things done.
While I rarely literally copy & paste, quite often what I'm doing is very much about the same thing. I look at an SDK or API, read the samples, then start coding/typing. But what I'm really doing is basically just copying. This is the ACME SDK, and they say I need to do X, Y and Z in order to achieve A, so... I'm sure anyone that's worked with different SDKs, APIs or frameworks knows what I mean.
Here are 3 lines from a piece of software I'm working on right now:
ProcessStartInfo psi
= new ProcessStartInfo
();// openssl genrsa -out my-private-key.pem 1024
psi.Arguments = string.Format("genrsa -out \"{0}\" 1024 -rand \"{1}\"", file, randomDataFile);
The second line I literally copied & pasted from some documentation in some other software of mine. That was copied and edited from other documentation. Sometimes there's only 1 way to do things, and you basically either retype it or copy it outright.
The third line is just retyping, editing, and adding in some extra things from the second line.
But this is starting to get very long... I'm going to leave it at that for the moment. (Decidedly incomplete.)