eng
competition

Text Practice Mode

12 Rules To Learn Code

created Aug 11th 2020, 15:59 by L0C0


1


Rating

1818 words
4 completed
00:00
1- Trick Your Brain with:
Learning to code is a bit like going to the gym. Even if you max out and spent a whole weekend at the gym, you will not see a visible difference in your body. The more regularly you learn to code, the more likely it is that you’ll start seeing your ripped coding muscles. (The irony is not lost on me). But the problem is where do you find the time? Between working your full-time job, spending time with your family and life admin, when are you supposed to sit down and practice this “daily coding”? While I was working as a doctor, I spent about 12 hours at the hospital, 1-hour commuting and approximately 2 hours on general life-sustaining stuff, such as eating. So that left me with only 9 hours remaining in my day. Theoretically, 2 hours could be allocated to coding practice and 7 hours on sleep. But there is nothing more difficult than trying to convince your work-saturated brain to sit down and learn when you could be watching Game of Thrones with a tub of ice-cream. But then I found a trick. As humans, we have a lot of inertia. This can be bad for us - I’m looking at you, “24” box set. However, we can also turn it to our advantage. I found that once I got started coding and making things, I got so absorbed into the project, that I no longer cared about TV, food or sleep. There were quite a few weekends when I coded until sunrise. So how do we take advantage of this inertia? First, you must understand that task-switching is very difficult. It requires a lot of motivation. If as soon as you get home, you slump on the sofa and switch on the TV, you’ve already lost that evening. This is because the amount of motivation required to task-switch and do something not driven by evolution like eating or sleeping is a Herculean task.
This is why the moment you enter the door and change to a new environment is the most crucial moment. If at this moment, you tell yourself that you are just going to do 20 minutes of coding practice, you will most likely succeed and use your own inertia to end up learning for an hour or more. No brain will perceive a 20-minute task as a lot of effort and you end up tricking your brain to take advantage of your evening. The next step is to develop a habit. Research suggests that in order to develop a new habit, you have to carry out the task daily for a month. I’ve used this next trick for loads of different things, from exercising to coding, it invariably works like a charm. To preface this trick, I want you to imagine a wall with five paintings hanging on it, four of which are perfectly aligned, perfectly horizontal, but one is crooked. Now really imagine it, is there a part of you that wants to fix it? Now let’s imagine a monthly calendar with boxes representing individual days. If you nurtured that new habit on a particular day, then you make a line through that day. If you continued your streak the next day then you extend that line and so on and so forth. There is something about not breaking a continuous line that motivates most people to continue to develop a habit. As strange as it sounds, there are many times when I would have given up, but compelled to continue because of a long, continuous line.
2- Code for a Purpose:
When I first started learning how to code, there were countless times when I picked it up then gave up, again and again. This is a common story amongst self-taught coders. Looking back, after teaching so many students, I finally realise what’s going on. A lot of beginners start learning to code by picking an arbitrary language and follow along with a bunch of tutorials. Copying code, line by line, sometimes writing code to work out prime numbers, other times to find all the even numbers. But you know what? I can find prime numbers a lot faster by Googling for it and picking out even numbers is really not all that interesting. Here’s the truth. If you are learning to code for the sake of learning to code, it’ll be pretty difficult for you to get good at it. Skills that require a lot of time to hone, like programming, will eat into your pool of internal motivation. Something from within that makes you forget to eat and sleep. I can honestly say that coding on my own projects is one of the most enjoyable things I do. It combines logical thinking with creativity, and at the end, you will have made something. In most cases, something that the world has never seen. Something that could make your life easier or more enjoyable. Something that could make loads of people's lives easier and more enjoyable. It’s like making a crazy-beautiful custom motorbike in your garage, without needing the garage or spending a cent on the components. This is what motivates most people. The creating part. The making part. So I urge you to start learning to code by following a tutorial that makes something, anything. Of course, it’s unlikely that at the beginning you’ll be able to code up Clash of Clans or League of Legends. But you’ll be able to make something interesting. It could be a dice game or a flash-card app. But as long at the end of the tutorial, you’ll have made something you can use and play with, then you’ll be far more motivated to code to the end. During all our courses, we always tell our students to think up of a simple app that they want to make. Something that uses the skills that they’ve learnt during the course but will also stretch them a little because they have to find out how to include some new functionality. We had a student who went on to make an app that wakes them up a minute earlier every day to ease the transition to an earlier waking time. There’s a student who made a custom slideshow app as a mother’s day present. Someone else made an app that is a timer for making perfect steaks based on its weight and thickness. There are no limits on your imagination. It will be difficult when you start working on your own app because there are no step-by-step instructions, but it will also bring about the biggest improvement in your coding ability.
3- There is No "Perfect Language to Learn"
Whenever I do large talks, there will always be one person who asks me “which programming language should I start learning first”? There is this common perception that somewhere out there lies a perfect language for beginner programmers. Some argue it’s Python, some say it’s Swift. But I say they’re all wrong. A programming language is simply a tool. It is no different from any other tool in your hardware box. If you want to hammer a nail, you should be using a hammer. If you want to fix your water pipes, you’ll probably need a spanner. Yes, it’s possible to hammer in a nail using the side of the spanner and the same programming language can be used to solve different types of problems. The carpenter will tell you that his favourite tool is a hammer and the plumber will say it’s the spanner, but it still doesn’t make it the “best tool to fix things”. A web developer will tell you that JavaScript is the best language to learn for a beginner. A statistician will advise you that you’ll be best served with the R programming language. But at the end of the day, all that matters is what you are trying to do with your tool. If you want to make iOS apps, then learn Swift. If you want to make websites, you’ll need JavaScript. But the good news is the core programming concepts: loops, conditionals, functions, etc. they’re all the same. The difference is mostly syntactical. In English, we have werewolves, in German they have Werwölfe. It’s still the same shirt-ripping mammal that comes out during a full moon, it’s just spelt differently. Printing to the console in Swift: print(“Hello Werewolves”) Printing to the console in Java: println(“Hello Werwölfe”) So, decide on the task that you are trying to accomplish, then pick the best tool for that task.
4- Understand What You’re Writing:
I have an issue with the way that most programming tutorials are written. There are far too many tutorials where you see the “this is how you draw an owl” phenomenon. It’s almost as if the programmer had good intentions and started off by showing you how to do everything, step-by-step. But then, at some point, he realises that he has embarked on a Sisyphean task and gives up. I’ve seen tutorials where the author starts off with an excruciating level of detail then mid-way reverts to “now you simply set up a cloud database”. Bearing in mind that this is a tutorial aimed at beginners! This leads to a number of problems. The most common problem is a student who just copies the code in the tutorial and has no clue what any of it does. Why did he add that extra line after parsing the JSON? Why is he making this dictionary differently from the last one? It’s very easy to get knees deep in one of these types of tutorials because it promises to teach you how to build “Flappy Bird” or “Candy Crush”. But two-thirds of the way in, none of the things you’re typing makes sense and you start seeing red all over the screen. Bugs. Loads of them. Why? No idea. Nothing runs. The last 3 hours were spent copying code and you learnt nothing other than maybe that coding sucks. Don’t get into this trap. If you see a tutorial that has jumps from beginner to advanced after line 3 or uses the word “simply” too liberally or doesn’t explain any of their code, then stop. Leave that tutorial. There’s plenty of fish in the sea. Other times, the author does try to explain what they’re doing. But you still don’t understand a thing that they’re saying, then you’re in an advanced tutorial that won’t improve your programming. It can be tempting to build grand things, especially when the blog is promising that anyone can make it. But if you can’t work out what’s going on, you’re be better served by building a better foundation. The key to learning to code is all about ramping. You want to be stretched over and over again and for knowledge to be built on previous knowledge.  

saving score / loading statistics ...