When I was 15 years old, I had developed an interest in how computer games were developed, as I was regularly playing first person shooters including the Call of Duty series. I learnt that these games were developed with the C++ programming language, so one day I went to the Borders bookshop and purchased my first programming textbook, which was Ivor Horton’s Beginning Visual C++ 2008.
The textbook was over 1000 pages big and when I began reading through it, I could barely understand what was going on. The chapters contained pages of complicated explanations of the concepts ill-suited for beginners. It took me months of frustration to literally get a basic understanding of what data types and control loops were. I had made the drastic mistake of purchasing a poor resource to learn from and I didn’t have the understanding of how to actually learn programming.
Now days when I tutor students at university who are new to programming, a lot of them are struggling to learn because they just didn’t get a rundown of how to actually learn programming. So here are my tips on how learn programming when you’re completely new:
1. Pick a resource to learn from
I’m going to be honest here. A well-produced resource will help you learn programming quicker and dramatically cut down your learning curve. This can include a paid online course or a decent textbook which is written for beginners. If you go into a bookshop today, you will see several programming textbooks you can choose. My advice would be to spend your time browsing around, looking for a beginners book that explains everything in plain English and isn’t over a thousand pages big. It’s true that you can learn programming for free via YouTube/Udemy and searching on Google for tutorials, but most of these free resources are not produced in a high quality manner and you’ll end up getting more bogged down and confused.
2.Run example code shown
The well-produced resource you are learning from should contain example code which you can read and follow along with. The key thing that will help you to learn programming is to actually type the example code into the compiler, instead of directly copying and pasting it in. Why do I recommend doing this? It’s easy to look at the example code shown and say to yourself that you understand it, but you might actually not. Another advantage of doing this is that it will help you to develop an understanding of the programming syntax and gain an understanding of what the code is trying to achieve. After you have typed in the code into the compiler, run it and see if it works. If it does, the next thing to do would be to make some small changes to the code which can include changing the values and see what it outputs.
3.Undertake mini programming projects
After you have started getting a hang of running and editing example code from a resource, the best thing to do would be to try and write your own code from scratch and undertake mini programming projects. A key thing here is that this should take up 50% of your time of learning a programming language. The best way to programming or anything is by doing. This is because it will be creating connections inside your mind of what you have learnt and get to see how the concepts are applied to small applications.
You don’t have to program the next Grand Theft Auto game from scratch, but just something small and fun which showcases the programming concepts you have recently learnt. Some beginner ideas include:
- Math calculator
- GPA grade calculator
- Text role playing game
- Programming reference guide
4.Learn and understand code documentation
Code documentation is something that a lot of new people skip, but it’s actually one of the most important aspects of programming. It is how the author of the code is communicating and explaining to you what is happening. In order to understand other people’s code, you have to understand the complete fundamental programming basics inside and out. The best way to see if you can understand code documentation shown to you, is to try and imagine explaining it to a five year old. By doing this, it will allow you to break down what is happening and explain it in plain English.
When you become competent in writing your own code, you must also include your own code documentation. For example you write a program without any code documentation and you forget about it and open it up six months later, you are going to forget and understand what you were trying to achieve.
If you choose to study computer science/engineering or work at a software development company, code documentation is how you communicate with other programmers on what you’re trying to implement and achieve with the code you have written. Without it, most programmers in teams would just be running around in circles, trying to figure out what is happening.
5.Don’t be afraid of syntax and compiler errors
The hardest part of learning programming is dealing with problems of syntax and compiler errors. In a perfect world, the code you write for the first time will run perfectly but this is rarely the case as you will make mistakes. These mistakes will include simple syntax errors including mistyping variable names and forgetting semi colons.
After you get a handle of fixing syntax errors, you will soon run into run time errors and your code crashing due to bugs. It’s all part of the learning process which all programmers have to face head on. This is also the stage where most beginners quit because while these can be the most frustrating, it’s also where you will be consolidating and learning in the background.
As you go through these frustrating times, you will start to build up a bank of reference experiences, so in the future you will know what to do if the error happens again. Don’t throw in the towel and give up immediately when you are faced with a problem are struggling to fix, as going through the process of fixing these problems are where it’s the most rewarding.
The way to overcome these difficult errors is to copy the errors shown in your IDE and search them up online, as there have been many programmers who have experienced the problems you’re trying to fix. You need to fail in order to learn, so don’t be afraid to make plenty of mistakes. Remember when you are learning programming, the three major things you need are perseverance, patience and positivity.