6 ms·
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 t
by nileshk 14y ago
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.
- Derbasti 14y agoAlso, I just love that clickedy-click and finger movement. Actually, both of the above are queues that can help the brain retain stuff.
- measure2xcut1x 14y agoI 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.
- hammock 14y agoCan 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.
- powdahound 14y agoSimilar 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.
- hammock 14y agoYou know what, this guy makes a good point to consider as well. http://news.ycombinator.com/item?id=4922853 http://news.ycombinator.com/item?id=4922853
- Lockyy 14y agoThis 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 http://inventwithpython.com/pygame/index.html
- cjg 14y agoSure, 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.
- gavinflud 14y agoCopying 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.
- tedmiston 14y agoI 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.