In the field of software development, many problems are caused by some bad programming habits. Eliminating these bad habits will make your development easier and more efficient.
1. There are spelling errors in the code
Don’t be surprised, this is a very common problem, and the most crazy thing about it is that it has nothing to do with your programming ability. Still, a misspelled variable or function name can have disastrous consequences, and they can go unnoticed.
So how to solve it? You should use a good integrated development environment (IDE) or a programming-specific code editor, both of which can greatly help you reduce spelling errors. Another way is to deliberately choose names that are easy to spell as variable and function names, so that errors can be easily found. Avoid words that are easily misspelled. For example, receive is easy to misspell as recieve, and they are difficult to spot.
2. The code is not indented or formatted
Indenting or formatting the code can make it easier for people to read and locate errors. In addition, because it is in a coherent format, it is easier for others to maintain your code.
If the IDE you are using cannot automatically unify the format of the code, you can consider using a code beautifier like Uncrustify, which can format the code according to your settings.
3. Do not make the code modular
Let each function implement and only implement one function. This will make the function shorter and easier to understand and maintain. Longer functions usually have many paths in them, which is difficult to test.
A good rule of thumb is that a function should not be longer than your screen. Also, if there are more than 10 if statements or loop statements in a function, then it is too complex and needs to be rewritten.
4. You mistakenly think that your IDE is safe
IDE and other tools can improve the efficiency of writing code. They can suggest (complete) your variable names or other based on your existing input and scope. content. However, this type of tool is not safe enough. You will choose some options just because they look like the one you need. In fact, you do not have the option that is the one you want. In fact, it just reduces your thinking, but you still need to confirm.
7. Increase manpower to speed up progress
Almost all software development projects are behind schedule. Increasing manpower for the project is theoretically possible and very good. But this is actually a common misunderstanding. In fact, this usually reduces overall efficiency.
8. Use wrong time expectations
Again, don’t be under the illusion that you can catch up behind schedule. If you're already behind schedule, it's because your estimate was wrong, and you should re-evaluate the entire project cycle instead of blindly sticking to the wrong schedule.