5 years ago
Share this article Reddit Twitter Facebook Google+

6 bad habits in programming you should avoid

I have developed some good habits after years of development experience. I also found some of the bad habits I will avoid. In this article, I show some of the bad habits I've observed in the development process. The discussion here is all my personal opinions. The so-called bad habits in this article may be good habits that other developers uphold.

Bad habits 1, rely on code formatting tools

Many programmers like to use code formatting tools to beautify their code. I usually disable the code formatting tool when I install a new IDE or code Editor such as Visual Studio. I'm doing this for a couple of reasons,

Bad habits 2, rely too much on the IDE

A good IDE(integrated development environment) and code Editor will undoubtedly increase productivity. I myself have some long-used and favorite IDEs, such as Visual Studio, Qt Creator, and Visual Studio Code. But if you're only used to some kind of IDE, and you almost can't work if you don't have the IDE, then it's a bad habit. Excessive reliance on the IDE can have the following problems,

We can enjoy the efficiency gains that the IDE brings, but we also need to develop habits that we can develop efficiently without the IDE.

Bad habits 3, rely too much on the debugger

You may be similar to me that we think Visual Studio or GDB debugger is powerful and convenient. But reducing reliance on the debugger will make our development more efficient,

Bad habits 4, comment too much in the code

Countless companies, teams, so-called mentors and senior developers, as well as so-called code style guidelines, are working tirelessly to teach and require programmers to write comments and documents in their code. But when I see too many comments in the code, I just think it's a potential problem, not a norm that should be advocated,

Note that I'm not against comments in the code, I'm just against using comments to replace the work of improving code readability. Comments should appear in the following places,

Bad habits 5, inconsistent code and programming style

This is perhaps the least controversial point. In a project and a team, no matter the existing programming style is good or bad, we should keep a consistent code style. If the project uses MFC style m_ as member variable prefix, then you should also use this style, even if you think the style is very outdated.

Bad habits 6, "work too hard"

You must have found the quotation marks on the title at the first sight. Hard work is no doubt a good thing, especially trying to create something unique and creative. But when you find that you are happy to do repetitive things, there is a problem, because the computer was invented from the first day to solve the repetitive work.


After reading all the bad habits I have listed, perhaps you agree with certain points of view, and disagree some if not all. Never mind, these are inherently more subjective opinions.