Live data from Hacker News

Want to learn to code? Don't copy and paste, type out other people's code

shockoe.com

11–20 of 184 posts

Re: Want to learn to code? Don't copy and paste, type out other people's code

#13
In some ways I disagree with this: I think that it depends a lot on the type of person writing the code. In the past I have found when I copy the code it is essentially a copy-paste level of thinking (i.e. none at all) that takes longer. There are times when I feel that when I am typing out example code I pay less attention than when I copy paste. When I copy/paste, I at least usually try to look for the important parts of what is going on, but when I am typing it out, I am too focused on making sure I have a comma instead of a period, or matching parentheses, etc. And not to mention I tend to leave out comments that probably should be there in the interest of being sick of typing.

To be fair the case I am imagining myself in is the times I have looked up something relatively simple like opening a socket or something pretty mundane, so this may not apply to all situations.

Re: Want to learn to code? Don't copy and paste, type out other people's code

#14
post #2

This is so true. After 20 years, I've recently switched from csh to bash (so I can use rvm), and I've been applying this neuro-hack to less-used command. When you copy-and-paste, there's a kind of finger-learning that you miss out on.

Absolutely.

Learning to play a guitar, for example, is difficult and yet crazily creative for this reason. It is (almost) completely behind finger-learning and thus in many original forms each with a signature of the individual who created the piece.

Re: Want to learn to code? Don't copy and paste, type out other people's code

#15
Don't have time today to provide citation but I believe the act of writing and transcribing involves a different part of the brain than reading...this is my layman's theory as to why writing and reading is so much more stimulating than just reading, even when you can easily comprehend the code on sight

Re: Want to learn to code? Don't copy and paste, type out other people's code

#16
post #15

Don't have time today to provide citation but I believe the act of writing and transcribing involves a different part of the brain than reading...this is my layman's theory as to why writing and reading is so much more stimulating than just reading, even when you can easily comprehend the code on sight

I've seen that too, but also seen that it the effect isn't quite as dramatic when typing vs. writing.

Re: Want to learn to code? Don't copy and paste, type out other people's code

#18
post #9

Even more important is to go over every line and don't go on to the next line until you are sure you understand. Just like you can read without understanding you can type without understanding as well. Forcing yourself to understand will make you a much better programmer.

Well, in one sense, I agree. Make sure you know what each line does on its own. But sometimes a single line doesn't make sense, in a larger sense, without something that comes later. So you have to have some tolerance for not understanding each line before you move to the next. It could be put in terms of knowing the "what" vs letting the "why" be uncertain a while.

Re: Want to learn to code? Don't copy and paste, type out other people's code

#19
post #9

Even more important is to go over every line and don't go on to the next line until you are sure you understand. Just like you can read without understanding you can type without understanding as well. Forcing yourself to understand will make you a much better programmer.

Well, in one sense, I agree. Make sure you know what each line does on its own. But sometimes a single line doesn't make sense, in a larger sense, without something that comes later. So you have to have some tolerance for not understanding each line before you move to the next. It could be put in terms of knowing the "what" vs letting the "why" be uncertain a while.

Absolutely, not all code can be understood by a 'single-pass' reader.
Post reply on HN