Live data from Hacker News

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

shockoe.com

21–30 of 184 posts

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

#21
When learning code out of a book for a new language, one trick I found that worked really well was to read the code, then close the book and try to type as much of it from memory as I could. I would futz with it for several minutes exploring various ways of making it break, seeing if I could 1) predict how I was breaking it, and 2) use the error messages to fix my mistakes.

Then I would open up the book again and compare it to what I had typed, examine the differences between them, and see if/how they explained the errors I was getting.

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

#24
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.

it's odd but in my experience I have found it to be the opposite. Perhaps because I've grown up with keyboards I find typing something out to be quite stimulating. When writing things down I find there is a huge disconnect between the funny scribbilous motions of my wrist and the meaning of the words they produce. Although perhaps that's a left-handed thing.

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

#25
I don't have the same experience as most people here. I usually just study by reading or trying to recreate the scene/code/history in my read, and works greatly to understand and memorize. When i write it takes time and feels like wasted time.

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

#26
Just out of curiosity, how many people took their first steps in programming by typing out code from a book or magazine?

- When I started out, including a floppy disk with a book or magazine was a rarity, so BBC Basic, Spectrum and PCW-9512 had to been typed in by hand, with frustrating hours trying to figure out why they didn't work (usually typos)

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

#29
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.

This is very much in-line with the way the Learn to Code The Hard Way books are written. There's even a call to action at the beginning of each book imploring the reader to avoid copy-paste:

http://learnpythonthehardway.org/book/intro.html

Post reply on HN