Total Pageviews

Thursday 24 March 2016

Learning to Code by Writing, not Copying

"Yeh, If your a experianced coder, five mins no problem but if your a bigginer it can take hours." - Rowen Henderson8

"it would help a lot if you ppl would copy and paste the code into your videos on the bottom." - Emjay Club

"Fantastic but please add the script somewhere so we can download it... sorry too lazy to read from video and type it :)" mete kavruk

Often when I make a 5 minute video about computer programming, I don't include the code text file in the video description. Why not?

Give me the code!
Here are some common arguments:

  • Writing the code for your five minute video can take hours for beginners.
  • I just want my game to work now. Can't you help me?
  • Aren't you all about open source? Why isn't your code open source?
  • Something is wrong with the code I wrote, but I can't tell what it is. Can I have your code, to compare?

It Takes Me Hours!
So you say that it takes you hours to write code that I can write in a five minute video. Do you ever wonder why that is..? Programming isn't just about understanding the code that you see. You need to be able to write it. This includes physically typing on a keyboard. If you're having trouble writing my code, then that's the number one skill you should be working on. Working hard to copy my code is not a waste of time. You are learning a skill.

Using Autocomplete is a Skill
People tell me all the time that I type "super fast" in my videos. Well I don't. I use autocomplete! Using autocomplete is a skill. If I need to type "gameObject.transform.position;" I'm actually typing "ga.tr.p;". And if autocomplete isn't working... you know what that tells me? It means my code has a problem and I need to fix it right now!

Okay, I do also type very fast.

Usually when autocomplete stops working, people keep writing code. No! Things are just going to get worse and worse from there. The only "broken" line of code should be the one you're writing.

I've also seen students confuse semi colons and colons (";" and ":") or struggle to find inequality signs on the keyboard (like ">" and "<"). If you want to make games at any level you need to master the keyboard. Have a look at the very first comment in this blog post by Rowen:

"Yeh, If your a experianced coder, five mins no problem but if your a bigginer it can take hours." - Rowen Henderson8

Do you think he has mastered typing? Maybe English is not their first language. In that case, they're not using their browser's autocomplete (spellcheck) feature. I guarantee these are the skills they need to work on most in their journey to make their dream game.

Following Tutorials is a Skill
When I follow tutorials, I don't copy code exactly. Maybe you've had a tutorial before that told you to write:

print('hello world')

but instead you wrote:

print('hello capybara!')

This too is an important skill. You can learn more from a programming lesson if you make personal changes too. This develops your skills because later on when there's an error in your project, you need to decide if it's a problem with your personal changes, or a problem with how you copied the tutorial, or a problem with the tutorial itself. You need to learn how to be cautious when personalizing a tutorial.

If you just copy a script, it's very natural to do zero tinkering.

Aren't You All About Open Source?
Yes. One of the wonderful things about open source is that anyone can copy a project, learn from it, or help make it better. The thing is, I don't care if people can copy a project that I wrote in five minutes. And my viewers can't really make my code better... or else I'd have to make a new video (making videos takes a long time!). This brings me to:

Why Do I Make Tutorials?
I feel that most people are technology illiterate. New technologies don't take off, and research doesn't get funded because investors are tech-illiterate. Governments openly discuss banning encryption or eliminating our privacy because voters are tech-illiterate. Businesses don't join the community of free and open source software as often because their employees are tech-illiterate. Public funds are wasted because government committee members are tech-illiterate.

Technology illiteracy threatens democracy, it's hugely wasteful, and it's a huge pain in the ass personally in my day to day life. Making videos and not sharing my code snippets is my way of getting people to think computationally, pay attention to detail, and become literate.

Whatever... So When Can I Get Your Code?
Okay fine! I do sometimes share my code. For example in my portal gun video, I decided the scripts were too long to copy. Copying them from the video wouldn't be a good use of a learner's time so I shared them in the video description.

Finally, I do have a Patreon page. If you like my content, you can give me a dollar, or any amount, for every video I post. Supporters have the option of downloading all the scripts in my videos.

Pedagogically, I don't like this option so much. But I decided to give subscribers the option as an incentive to help support the creation of more videos. The more I get paid to make videos, the less often I need to take other small contracts.