Most Common Coding Mistakes
There are many mistakes a programmer just starting can make. Today, you will learn the most common mistakes beginner make, and how you can avoid them.
1) Bad variable naming
This is by far the most common mistake beginner programmers make. Name your variables and functions as if your mom was going to have to read and understand what each one means (assuming your mom isn’t a programmer, of course.) In three months, are you going to remember what the variable you named “
dsld” means, or what that function you creatively named “
2) Not using comments
Comments are an amazing way to remind you what a piece of code does. Too many beginners don’t utilize comments at all, which makes code messy and hard to read. However, there is a fine balance between how many comments you should use in your code. If you add too many comments, you’ll have to change the comments every time you change the code that it’s describing. It is best to use comments only when a piece of code is not completely self-explanatory.
3) Not keeping code formatting consistent
It doesn’t matter if you put the brackets on the same line as the “if” statement, or if you name variables with camel case or underlines. Just make sure you keep it consistent. If you don’t do this, your will code look very amateur, and hard to maintain.
4) Not backing up your project
This is a mistake that could lose you years of your life. Backing up your code is extremely important, even if you are not working on a team. Do not be intimidated by GitHub! They created a great application called GitHub Desktop. GitHub Desktop makes it extremely easy to sync & save your work without even touching the command line. Best of all, it’s free!
5) Using an overly-complicated language
Don’t feel pressured to code in a language that you’re intimidated by just because that’s what many others do, and especially don’t code a custom engine. There are multitudes of easy-to-understand languages that are very beginner-friendly. And, once you know one language, it’s very easy to learn any other language.
6) Not utilizing the debugger
When you run into a code error that you do not know how to solve, don’t make the mistake of just diving into the code and reading. Use the debugger. Most IDEs have them. With the debugger, it makes solving issues a breeze, you can watch your code run line-by-line, so you can see exactly what’s going wrong.
7) Creating functions that are too big
Don’t make functions that take in many inputs, or functions that only accomplish one very specific task. Break up your function into multiple other functions, which are easier to read and maintain.
Hopefully, these tips have helped you out. Happy coding! 🙂