Live data from Hacker News

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

shockoe.com

121–130 of 184 posts

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

#121
post #92

I learned to code essentially from books. I tried the type it out method. It was... um... a dismal failure. I would type it in, and I would have no idea what happened. It was all in code . There was magic in them thar characters, and the magic wasn't working. So I regrouped and started writing my own code. Lots of code. Very bad C++ code. Excruciatingly bad code. Over and over again. I desperately wanted to understan…

It isn't that typing it out is the best possible way to learn, it's that copy-pasting is a terrible way to learn - even worse than just typing it out.

> it's that copy-pasting is a terrible way to learn - even worse than just typing it out.

Can't disagree with that. :-)

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

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

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.

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

#125
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 to code is to pick a small-ish project that you personally want to use and just get started. You'll screw up a bunch of times, but it's the only true way to learn coding.

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

#126

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?

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

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

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

#128

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?

I would consider a basic chat application or a web-based text editor a small project.

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

#129

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…

If I may add to this, I found it really helpful to comment out every line as I went. Even today, when I want to learn new languages or frameworks I pick a repo on github and copy the whole thing line for line, commenting as I go. I found that this helps a lot.

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

#130

Earlier quoted context omitted.

The website in question might not have proper Cache-Control headers, so the page may have never gone into the cache.

But the question still remains why would Cloud Flare advertise this?

It would appear that in this case, advertising it allowed the user to fix the problem. It's a trade-off, certainly.

It also means I've now heard of Cloud Flare.

Post reply on HN