News for hackers. Stuff that matters.
Re:Want to learn to code? Don't copy and paste, type out oth... by nileshk on Friday December 14, 2012 @12:19PM (#4921973)
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 tutorial's code and learn what your mistake was, and you still get the benefit of learning about the particular error you experienced.
Re:Want to learn to code? Don't copy and paste, type out oth... by hammock on Friday December 14, 2012 @02:18PM (#4922695)
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 some reason, probably because I was a tiny kid learning a new thing, this tedious task was so much fun. And that's how I learned my first programming language. Never opened a single tut or instructional book.

Re:Want to learn to code? Don't copy and paste, type out oth... by powdahound on Friday December 14, 2012 @02:26PM (#4922752)
Similar story here, but in the late 90s. I used to print out TI-82 calculator apps/games and type them in by hand because my parents wouldn't buy the $60 connector cable. It was surprisingly fun. All my initial programming knowledge came from debugging the typos I had made.
Re:Want to learn to code? Don't copy and paste, type out oth... by Lockyy on Friday December 14, 2012 @05:04PM (#4923609)
This is pretty much how the book I'm using on Pygame is working. It's a load of games written in Pygame that the author encourages you to copy out and try to learn how it works yourself. Then afterwards he explains in detail how it all works. The writing it really helps with learning how you can use the simple stuff together to make more complex stuff.

Book: http://inventwithpython.com/pygame/index.html

Re:Want to learn to code? Don't copy and paste, type out oth... by cjg on Saturday December 15, 2012 @04:12AM (#4924999)
Sure, I can relate to that. In the early eighties computer magazines had huge listings of code which I dutifully typed in.

They never worked worked first time as I'd invariably mistyped various characters, but the subsequent bug finding taught me about how the code worked.

The bonus was you got a playable game at the end of it.

Re:Want to learn to code? Don't copy and paste, type out oth... by hammock on Friday December 14, 2012 @03:18PM (#4923063)
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 oth... by measure2xcut1x on Friday December 14, 2012 @02:05PM (#4922607)
I was surprised at how effective it was when I started learning c# by forcing myself to type all of the exercises. What I was also pleased with was that it really helped me quickly recognize and remember patterns(code shapes), even before I understood how they worked. Plus I could leave comments for myself to come back and learn more in the difficult spots. Highly recommended.
Re:Want to learn to code? Don't copy and paste, type out oth... by tedmiston on Friday December 14, 2012 @02:44PM (#4922870)
I do this.

My very first programming class was Java and I had no experience prior.

I felt so alive writing every character and every line. I was too excited to read the paragraphs of description in the textbook because the code told most of the story anyway. I could look at it, read it and mostly understand it, then retype each character at a time and watch it work. Once it worked, I varied small things. Anything I could improve. Sometimes the goal was to make it as condensed as possible, sometimes it was to try to make it simpler to read, or to adapt a method for ints to also work on floats, or to add parameters making the code even more flexible. Kid in a candy store mentality fits perfect.

I did this for almost every example in the book, even ones we didn't cover in class, a few hundred in total.

Re:Want to learn to code? Don't copy and paste, type out oth... by Derbasti on Friday December 14, 2012 @12:24PM (#4922016)
Also, I just love that clickedy-click and finger movement. Actually, both of the above are queues that can help the brain retain stuff.
Re:Want to learn to code? Don't copy and paste, type out oth... by gavinflud on Friday December 14, 2012 @02:35PM (#4922818)
Copying and pasting is fine if you're copying code you've written yourself. However, as you said, it's a lot more beneficial when you type out code because you'll make mistakes and have to figure them out.

It's very hard to learn how the code you're using works when all you've done is copy and paste it.