As previously mentioned, starting your programming journey is something that is not for the faint of heart. It requires troubleshooting sessions that will drive you insane. Fortunately, there are a few more ways to mitigate these problems. For starters, don’t focus too much on optimizing your code when first learning. Optimization could be considered to be the root of all evil. Obviously, you should be mindful of performance on a macro level, but worrying about the micro level too early will just suffocate your progress. Start optimizing after you already have a completely functional product. If you’re just starting out and you’re already primarily concerned about performance, you’re doing something wrong.
Next, learn how to use a debugger. Especially early, it will be an incredibly valuable tool not only for your sanity but for your learning as well. It will help you understand how your code works better than any other single task you can perform, and it will also help you find exactly where your code doesn’t work. On a similar note, learn how to use a profiler later on as these will also help you gain insight into your code. If you’ve learned the basics of a programming language but haven’t grasped debugging using a debugger yet, stop everything and dedicate yourself purely to that task.
While this might not apply to everyone... if you have access to a peer you should always ask for their judgment. Peer-reviewed coding, while annoying initially, will prove to be invaluable in the future. Even if there is a large skill discrepancy, they can help you find code that just doesn’t make sense. When they simply go through the code and ask “Why did you do this?” you are forced to explain yourself, and a lot of times this leads to the response “Why did I do this?” that will result in better code. Many programmers are rather solitary, so this idea of peer-reviewed coding might be frightening, but it’s worth getting over any shyness that is present for the benefits given above.
Last, but certainly not least, always be learning more. There is a gigantic number of resources available for programming everywhere, most notably in the forms of books and internet articles. Unfortunately, you can’t just learn through absorbing the information directly from the source. You have to actually read it and learn. More to the point, if you’re following a tutorial of some kind make sure you’re actually following it completely. Shortcutting your way through a tutorial won’t teach you anything, so don’t start the habit now. Doing it properly will help develop muscle memory and in turn, help you learn.
Important Takeaways: Coding requires careful development procedures and extensive review procedures so anything that can limit the amount of backtracking that needs to be done is good for business. Don’t focus on optimizing your code on a micro level until it actually becomes a factor in the quality of your product. That’s a good way to just stop your progress. Learn how to use a debugger so that you can both learn how your code works and also find problems with the code at will. This skill is essential and should be learned immediately if it hasn’t already been. Use a peer or an experienced programmer friend to review your code whenever possible — they’ll often spot weird lines of code or wonky structuring that can be improved. Finally, actually know what you’re doing. You have to learn how to program, not just read programs. Follow tutorials all the way through and make sure you’re actually reading any materials that you have obtained instead of just skipping through and looking at examples.