Live data from Hacker News

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

shockoe.com

111–120 of 184 posts

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

#112
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 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 other people's code

#114

So a long time ago there were two C compilers on the Amiga, one (Lattice C) was the "official" C compiler and it was very slow, the other "Redhat C" was really quite fast. The nice thing about the fast C compiler was you could compile and know right away where the syntax errors were, the slow compiler ground along forever. A side effect of this was that before kicking off the slow compiler I would do a careful read o…

Someone - was it Kernighan? Ritchie? - wrote a nice description of this. In short, when you find the source a bug, don't just fix it - stop and think what caused you to make that error, and think about what else in the code might be a victim of the same line of reasoning (note: not necessarily the same code - just the same design decisions).

Back in the day when you had to submit your code to the computers overnight and wait until the next day to find out if you got your output or just a one-line compiler error, you were much more careful to avoid errors, big or small.

Having a longer iterative cycle can be good training.

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

#115

How is stuff like this news to people? This is fundamentals, people. Fundamentals.

yea. the thought of copy-pasting code is really weird. i would feel very uncomfortable doing it. i'm not surprised people copy-paste, though

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

#116
post #33

That may be an effective way to learn (ie. it works), but I have my doubts that it's a very efficient one (ie. you could learn more in the time you spend retyping that code) or a very entertaining one (ie. other ways of learning to code are more interesting).

I've found that it's easy for me to space out and just go through the motions if I'm simply reading or copying and pasting. Typing the code manually (or writing full notes in a university course, et cetera) forces me to focus enough that it actually drastically increases my efficiency.

So in my case, it's more work to type out code than to copy and paste, but it saves work in the long run.

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

#117
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…

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 other people's code

#120
post #93
post #67

Earlier quoted context omitted.

This is how I learned/am learning Erlang.

Reimplementing standard library functions is great for Haskell too. The biggest of the "big breakthrough" experiences I had was from trying to reimplement the standard monadic State datatype.

And then it stackoverflows and you learn that there are actually two standard monadic state datatypes :)
Post reply on HN