It often happens that you don’t notice your own mistakes when programming. You may notice that something is wrong, but finding the problem can take a lot of time and effort which you probably don’t have. To help out all our beginner programmers, we have compiled a list of common mistakes. These can help you avoid them or give you a few starting points when you come across a problem. This article is mostly aimed at C++ programmers, but it can be applied to other coding languages as well.
Mistake #1: You don’t follow a consistent writing style
Our brains can only process a certain amount of information at the same time. If you don’t write with a consistent style, you are making life very difficult for yourself. Make sure that you have consistent indentation, clear conventions for naming things, meaningful names for things, and meaningful but short comments. Use capitals, indentations, etc. to create a style that can become automatic and help you focus on the problem and not how to read the code.
Mistake #2: You write functions that are too big
Big functions are difficult to debug and maintain. If the function is too big, you can’t really understand what itis doing, there are too many interactions, and there are too many paths. A function is too big when it is longer than 50 lines, cannot be explained in one simple sentence, and has more than 8 if statements, looping constructs, and switch statements.
Mistake #3: You write without a plan
Before you jump in and start coding, you should have a plan to follow. Your plan should include specific requirements, room to design the program and interface, and time to design the test. If you work according to a plan, you will make fewer mistakes, know what you are working towards, have your testing ready, and be much more efficient.
Mistake #4: You don’t backup your work
For anyone working with computers in any way, backing up their work and files are essential. It is the same for a programmer. Make sure you do a backup regularly to keep your hard work and don’t lose it because of a power failure.
These are only a few simple mistakes, but if you sort these out, the rest should be easier to fix. Being prepared and having a plan is very important.