Live data from Hacker News

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

shockoe.com

131–140 of 184 posts

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

#131

When teaching people to code, I'll dictate for a bit, and then start asking questions as I go, and move them gradually toward building things on their own. Really only a technique that works one-on-one but it's worked very well.

A vital part of that is to ask questions that don't just regurgitate dictation, but to encourage risk taking. The more comfortable a student is with the possibility of being wrong, the more natural experimentation becomes. Always connect it back to progress toward something they are passionate about, whether they are technically inclined from the outset or not. This is why I like to skip "Hello World" type coding and fast-track them to making a tool that they actually want to use in their lives.

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

#132

As someone who learned to code recently (last 3 years), this advice is good but dangerous in the long-term. I started by typing out other people's code from various books or tutorials, but found that it produced a feeling of "success" that made me lazy in taking the step to producing my own code from scratch. I had that feeling of progress, without actually making real progress. In my experience the best way to learn…

Neither way is "the best way to learn code"; both are good ways, and they each guard against the other's harmful influence. Do both: when you want to copy code, retype it thoughtfully; also start a small project to do for yourself and jump in.

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

#134
Regarding the Hunter S. Thompson anecdote:

I've heard this story many times over the years and was always found it amusing but was skeptical that it did HST any good. I mean, what use is it to blindly just copy something letter by letter?

I did Nanowrimo on a whim this year and it was a lot of fun (I doubt I'm actually any good at it, though). In doing it I found myself going to Gatsby and a Hemingway book (The Sun Also Rises) for examples of clear, direct prose. I thought back to this Thompson anecdote and thought to myself that if I ever wanted to really pursue writing, a straight copy of one of those books would help my prose ten fold.

So I agree with this article. Type out the code you're borrowing from, don't copy and paste. Also, tchlock23 is right in that you also need to start some small projects from scratch and suffer through them with minimal help.

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

#135
Basically how I learned to code as a kid: type out the programs from Byte/Compute magazines. I eventually found books on BASIC in the library and typed out the examples from those. Then I'd modify them to add my name in there or make the dot jump a little higher. Eventually I was writing my own programs.

I assume it's some sort of "kinesis" style loop in the brain that is at work when you do this. "Hands-on," learning is a very useful tool.

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

#136
post #72

I agree with this especially when you are doing tutorials for this reason: when you type out code, you inevitably make typos that cause bugs. This forces you to learn what some of the common possible error conditions are and forces you to learn to find and resolve them. Learning these things when you have the safety net of a tutorial is ideal, because if you can't figure it out you can always compare with the tutoria…

Can anyone else relate to this? Back in the day (early 90s), I would go down to the public library, pick out a thick book full of computer games written qBASIC, and of course I had to type them in all by hand. We didn't have internet yet, the idea of copy-and-paste from somewhere did not even exist in my mind. So I would copy these 10,000-line BASIC programs in by hand into our 386 computer, one line at a time. For s…

You know what, this guy makes a good point to consider as well. http://news.ycombinator.com/item?id=4922853

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

#137

As someone who learned to code recently (last 3 years), this advice is good but dangerous in the long-term. I started by typing out other people's code from various books or tutorials, but found that it produced a feeling of "success" that made me lazy in taking the step to producing my own code from scratch. I had that feeling of progress, without actually making real progress. In my experience the best way to learn…

People have been telling me this when I express an interest in the interwebs, but as someone who only has a loose understanding of what a small project is, how can I pick such a thing?

The Ruby Rogues podcast had an episode devoted to starter projects recently:

http://rubyrogues.com/070-rr-what-is-a-good-starter-project/

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

#138

When teaching people to code, I'll dictate for a bit, and then start asking questions as I go, and move them gradually toward building things on their own. Really only a technique that works one-on-one but it's worked very well.

A vital part of that is to ask questions that don't just regurgitate dictation, but to encourage risk taking. The more comfortable a student is with the possibility of being wrong, the more natural experimentation becomes. Always connect it back to progress toward something they are passionate about, whether they are technically inclined from the outset or not. This is why I like to skip "Hello World" type coding and…

Right, you get them speculating, but speculating where they're comfortable enough. Where that boundary is depends on the individual...

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

#139
In a different domain, the journalist Hunter J. Thomson was known to type entire novels to learn the style of master novelists (http://en.wikipedia.org/wiki/Hunter_S._Thompson):

"During this time he worked briefly for Time, as a copy boy for $51 a week. While working, he used a typewriter to copy F. Scott Fitzgerald's The Great Gatsby and Ernest Hemingway's A Farewell to Arms in order to learn about the writing styles of the authors."

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

#140

Regarding the Hunter S. Thompson anecdote: I've heard this story many times over the years and was always found it amusing but was skeptical that it did HST any good. I mean, what use is it to blindly just copy something letter by letter? I did Nanowrimo on a whim this year and it was a lot of fun (I doubt I'm actually any good at it, though). In doing it I found myself going to Gatsby and a Hemingway book (The Sun A…

See http://books.google.ca/books/about/Day.html?id=kKOefRuY954C

The book, "Day," by Kenneth Goldsmith was created by typing out, word for word, an issue of the New York Times. It's considered a book of poetry.

Typing out a novel word-for-word doesn't seem all that insane to me. And it likely isn't a useless exercise either: artists learning to draw and paint have often tried to reproduce the works of the masters in painstaking detail in order to try and internalize the techniques and effects used. I suspect the mechanical motions of typing out a piece of writing you admire will illicit much the same response in your brain as it likely shares the same mechanism of reinforcement.

Post reply on HN